Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Client can't see host. how do i implement @RPC. to prevent that. Help Please.

Discussion in 'Multiplayer' started by Vadyy, Jul 27, 2014.

  1. Vadyy

    Vadyy

    Joined:
    Jan 26, 2014
    Posts:
    2
    Hey, the client doesn't see the host's player.(yes, i have don't destroy on load)
    i shall use this: http://docs.unity3d.com/Manual/net-NetworkLevelLoad.html
    but don't know how do i implement that in my script. don't really know how to use @RPC.

    here's my onserverinitialized/connectedtoserver code.

    <code>
    function OnServerInitialized () {

    DontDestroyOnLoad (transform.gameObject);

    Application.LoadLevel ("Game");

    lobbySpawn();
    }

    function OnConnectedToServer () {
    Application.LoadLevel ("Game");
    Debug.Log("Connected to server.");
    lobbySpawn();
    }
    function lobbySpawn(){
    Screen.lockCursor = true;
    yield WaitForSeconds(0.1);


    Network.Instantiate(playerPrefab, transform.position, transform.rotation, 0);



    if(Network.isClient){

    Destroy(this);
    }
    }
    </code>
     
    Last edited: Jul 27, 2014