- Home /
How to get references when load a new scene?
Hello Everyone...
I'm working with async loading scene and merging it... My problem is:
If I'm on scene A, so I trigger something and start loading the scene B, and on this Scene B there are objects that access my Player by "FindGameObjectWithTag" on Awake(). But it will find nothing, because my Player still on scene A... How can I pass through it?
If someone understand what I'm trying to say... help me please! Thank you.
Sorry my bad english
Almost two years late, ey! I actually asked a similar question, I'll see if I can remember to let you know if I find an answer to my situation, and it may help you too :)
Hey... actually I solved this by moving my Player from scene A to scene B, with: Scene$$anonymous$$anager.$$anonymous$$oveGameObjectToScene(player.gameObject, sceneB);
$$anonymous$$aybe it help you
Just seems that you cannot do this in Awake. You have to yield a frame before scene finished loading.
IEnumerator Start()
{
yield return null;
GameObject.FindGameObjectWithTag...
}