hi what i am trying to do is simply use a gameobject.find(“checkpoint”) but with a changable number at the end so im looking for the keyword checkpoint but all my objects are numbered so i need to put this at the end. but it has to be able to change number.
in short i need a way to say gameobject.find(“checkpoint”)1 but the 1 will eventually change by another script. so where do i put this 1 which is a varible named check
If you are looking for a way to access a variable inside a script attached to the object “checkpoint”, you should use this code:
GameObject.Find("checkpoint").GetComponent("ScriptAttached").check;
You can also modify it or assign it to another variable. You can use the same way to call function inside other scripts:
GameObject.Find("checkpoint").GetComponent("ScriptAttached").FunctionToCall();
ok so took me a while to finaly click in my head i was using && instead of + dope.
var CheckPoint : int = 0;
(“Start(Root)”+CheckPoint)