What is the best way to use the NetworkBehaviour OnStartLocalPlayer in Photon?

I was making a game using Unity's NetworkBehaviour, and switched to Photon, but I don't see a good way of using OnStartLocalPlayer yet.

Here is the line:

public override void OnStartLocalPlayer()
{
player.GetComponent ().material.color = Color.blue;
}

Comments

  • Hi @Wolf1806,

    I guess you can simply use Unity's Awake or Start function. When using PUN and instantiating an object by using PhotonNetwork.Instantiate, you can also use the void OnPhotonInstantiate(PhotonMessageInfo info) callback. Please note, that this one is actually called before Awake (and Start of course).