I am new to Unity and I am trying to set a GameObjects position.z OnEnable, but can’t figure out how to do so?
I set the camera OnEnable like this:
camera.transform.position.z = -1.7;
My GameObject is called “inventory” and I have tried like this:
GameObject.GetComponent(‘inventory’).transform.position.z = -7;
But i get this error: An instance of type ‘UnityEngine.GameObject’ is required to access non static member ‘GetComponent’.
Not sure how to do this… Any help is appreciated ![]()