Search Unity

spawn prefab problem in multiplayer game

Discussion in 'Multiplayer' started by anhtuannd, Oct 13, 2009.

  1. anhtuannd

    anhtuannd

    Joined:
    Sep 6, 2009
    Posts:
    1
    Hi all ! , I have a problem in my game when I instantiate a player.Client don't init the player who is instantiated before.
    I still see that code folow :

    Code (csharp):
    1. function OnNetworkLoadedLevel ()
    2. {
    3.     Network.Instantiate(playerPrefab, transform.position, transform.rotation, 0);
    4. }
    and call in function Awake :

    Code (csharp):
    1.        
    2. for (var go : GameObject in FindObjectsOfType(GameObject)){
    3.             go.SendMessage("OnNetworkLoadedLevel", SendMessageOptions.DontRequireReceiver);
    4.         }
    5.  
    6.  
    i don't understand this code , help me please !