player = GameObject.Find(“Game/Player/Chest”);
so the problem is this is not working and I don’t know why and any help is much appreciated.
(Note: The gameobject that this script is in is Disabled but the gameobject that im finding is not)
I think you need to put another slash before the Game in the string.
player = GameObject.FInd("/Game/Player/Chest");
player = transform.Find(“/Game/Player/Chest”).gameObject;
I found a way to do it and this is how I did it. I just changed it to this.
First of all , the term “disabled/enabled” is only for component , for gameobject it’s called “active/inactive” , Awake() will not get called on inactive gameobject , Awake() is still get called in disabled script as long as the gameobject is active .
So the problem here is that it’s not the GameObject.Find that isn’t working , but the Awake() itself never get called since the gameobject is inactive.
Don’t use find, it isn’t very reliable, try just getting a reference from the inspector using
public GameObject player;
then drag and drop