How to wait until Objects are synced?

Hi,
I am loading a level using PhotonNetwork.LoadLevel(...); . In this new level there is a GameManager object with the following code:
void Start () {
obj = GameObject.FindGameObjectsWithTag("Score")[0];
}

This results in:
IndexOutOfRangeException: Array index is out of range.

I think that happens because the Object "ScoreBoard" (has a photonView and is PhotonNetwork.Instatiated) wich has the tag "Score" is not synced to the client at the time Start() is called. Is there any function called when all network objects are fully synced? How should i solve that issue?

Comments

  • There is no such method "done with instantiation", because we don't know when you are.
    Either check the array-length in intervals or send an RPC or add a script with Awake to the Prefab you instantiate and call FindGameObjectsWithTag("Score") there or even better:

    You can put the GameObject into the scene, even if it has a PhotonView. Might be easier than syncing when you are "done" instantiating GameObjects.