Search Unity

  1. We have added sub-forums for the experimental MLAPI and Unity Transport Package. Please use the new forums to discuss related topics.
    Dismiss Notice

[FORGE] Spawn remote object only working after an update event

Discussion in 'Multiplayer' started by bigSadFace, Dec 25, 2015.

  1. bigSadFace

    bigSadFace

    Joined:
    Aug 18, 2014
    Posts:
    116
    Hi there,

    Just getting started with Forge. I am spawning a player object within my scene and have two prefabs set up to handle this. One is a very simply first person camera with the remote of this being a cube.

    They are named:

    Player
    Player(Remote)

    Both have been added to the networking manager under network instantiates.

    The problem I face is that if I host a session then join as a client without any update events happening (translation/rotation etc) The remote object does not display on the client. It only displays on the client if I trigger one of these updates on the host.

    The code I am using to instantiate is below:

    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. using BeardedManStudios.Network;
    4.  
    5. public class SpawnPlayer : MonoBehaviour
    6. {
    7.     private void Start()
    8.     {
    9.         if (Networking.PrimarySocket.Connected)
    10.             Networking.Instantiate("Player", NetworkReceivers.AllBuffered);
    11.         else
    12.         {
    13.             Networking.PrimarySocket.connected += delegate ()
    14.             {
    15.                 Networking.Instantiate("Player", NetworkReceivers.AllBuffered);
    16.             };
    17.         }
    18.     }
    19. }
     
unityunity