load varible after time

hi all just stuck on an issue which i cant seem to come up with a solid solution…

basically in my scene i have an object that uses gameobject.find to store a varible, but i cannot do this on start or awake as the object doesnt get loaded straight away for a few seconds.

so far the most reliable idea i have came up with is to assign a new function inside start that yields for so long and then finds the object.

however this isnt a solid solution as im relying on time. what i would like is basically either a wait until object is loaded then store as varible solution, so something like

when object is loaded
object = gameObject.find()

any help at all on this

Look into using Start as rutter says. Another idea: In Update, check to see if the variable has been assigned. If so, ignore. If not, do GameObject.Find, and set the variable. This will essentially look for the object until it is found. It’s not elegant, but a way to go. You could also have it look on every, say, 10th Update, or every 1 second, whatever.

Could that second object you’re loading in notify the first object when it’s spawned? Remember that both GameObjects will have Start() calls that you can use.