public class Decoration : MonoBehaviour { public Shadow block1Shadow; public void TopLineClick() { block1Shadow.effectDistance.Set(5f, 5f); } } 

I hung the method on the button, but nothing happens when I press it, the same values ​​remain, why?

enter image description here

How to change effectDistance through code?

    1 answer 1

    And does not confuse that effectDistance property, and the result is the structure of Vector2 ?

     var effectDistance = block1Shadow.effectDistance; effectDistance.x = 5f; effectDistance.y = 5f; block1Shadow.effectDistance = effectDistance; 

    Or

     block1Shadow.effectDistance = new Vector2(5f, 5f);