Search Unity

Resolved Modifying a Decal Projector's tiling in C#

Discussion in 'High Definition Render Pipeline' started by Cheo6, May 16, 2021.

  1. Cheo6

    Cheo6

    Joined:
    Nov 20, 2017
    Posts:
    28
    Hello, I'm trying to flip a decal projector by setting its x tiling value to -1, but setting the uvScale and uvBias Vector2s has no effect. Other properties like the fade factor and the draw distance can be modified through script though. Can anyone please help me with this ? Thanks in advance !
     
  2. M4dR0b

    M4dR0b

    Joined:
    Feb 1, 2019
    Posts:
    108
    Y-hello there,

    can you post your script and a screenshot/small video of the issue?

    I've tried like this and is working as expected.

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.Rendering.HighDefinition;
    5.  
    6. public class DecalController : MonoBehaviour
    7. {
    8.     public DecalProjector decal;
    9.     public Vector2 uvBias;
    10.     public Vector2 uvScale;
    11.  
    12.     void Update()
    13.     {
    14.         decal.uvScale = uvScale;
    15.         decal.uvBias = uvBias;
    16.     }
    17. }
     
    Cheo6 likes this.
  3. Cheo6

    Cheo6

    Joined:
    Nov 20, 2017
    Posts:
    28
    Okay, I realized what the problem was : instead of simply writing "decal.uvScale = uvScale;" I wrote decal.uvScale.Set(x, y);". This Set function was perhaps not intended to be used, I don't know. Anyway thank you very much for your time good sir !
     
  4. M4dR0b

    M4dR0b

    Joined:
    Feb 1, 2019
    Posts:
    108
    np, have a good coding :D