So I am trying to store a whole position in a variable and than trying to edit only a specific part of it such as ‘x’ or ‘y’.
I am pretty new on Unity so im not that much familiar with its API so please excuse me if i say something weird or even if my script is completely wrong.
So here is how i am trying to solve my problem:
public Vector3 position = transform.position; position.x = 1.1f;
this is what i get as an error:
Assets/Scripts/Player/Player.cs(10,27): error CS0236: A field initializer cannot reference the nonstatic field, method, or property `UnityEngine.Component.transform'
this is what i have at line 10:
public Vector3 position = transform.position;