Instantiated names issue

Options
Hi!

I'm currently trying photon and getting used to it, and i have one trouble:

when I use

GameObject playerInstantiated = PhotonNetwork.Instantiate (player.name, transform.position, transform.rotation, 0) as GameObject;

it creates a player(clone) how can I give it a name in all instances that are running it?

Thanks for your attention

Comments

  • Tobias
    Options
    You can make up a name and send it with the Instantiate call.
    There is an overload with an object[] data. You can access this data in the other clients when the object got instantiated. Access the PhotonView.instantiationData. Of course you have to assign the name when something got instantiated.

    Usually the object's name is not very relevant. You got the other player's name as PhotonView.owner.name and the PhotonView.viewID as identifier. You can use either to name the gameobject as something like "charachter_<playername>".

    Explicitly sending a name for an object is probably just overhead you can save.