- Home /
Question by
ThatOwlGuy · Aug 14, 2013 at 06:58 PM ·
updatefunctionnullgameobject.findvar
ID not recognized in function
In my quest script I want it to identify objects by their type and ID. I have a var setup as the objects ID that canbe changed in the Inspector and inside of function update I have it assign the specified object by its specified type and then whatever the quest's ID is.
so... var ID = "001"; var Object : GameObject;
function Update(){
Object = GameObject.Find("A"+ID);
if(Object.active == true){
print("you have your object");
}
}
the problem is that Object is returned null in the debug log and I'm not sure why. When I set the ID within the script it works fine. When I make the in function ID equal the first ID it returns null. help?
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613112224im_/https://answers.unity.com/themes/thub/images/avi.jpg)