I have it like this, when i press a button. In this case A or D, my cube (Children of my parent) has to move to the opposite side of my Player (Holding the cube). So the cube is the way, the character is facing / moving. 2D Platformer.
This is my code, that should work, but it doesn’t.
transform.GetChild(0).transform.position.x = transform.position.x - 1.5f;
Im getting the error:
Cannot modify a value type return value of
UnityEngine.Transform.position’. Consider storing the value in a temporary variable`