/// <summary> /// Sets a player as not ready and removes all visible objects /// <para>Players that are not ready will not be sent spawn message or state updates.</para> /// <para>Players that are not ready do not receive spawned objects or state synchronization updates. They client can be made ready again by calling SetClientReady().</para> /// </summary> /// <param name="player">The player to make not ready.</param> public void SetClientNotReady(INetworkPlayer player) { ThrowIfNotServer(); if (player.SceneIsReady) { if (logger.LogEnabled()) { logger.Log("PlayerNotReady " + player); } player.SceneIsReady = false; player.RemoveAllVisibleObjects(); player.Send(new SceneNotReadyMessage()); } }
/// <summary> /// Call this function on an object to move it to a new scene and rebuild its observers /// </summary> /// <param name="scene"></param> public void MoveToScene(Scene scene) { INetworkPlayer owner = Identity.Owner; // remove player from other clients removeObservers(Identity); // remove other objects from player if (owner != null) { owner.RemoveAllVisibleObjects(); } // move player to new scene SceneManager.MoveGameObjectToScene(Identity.gameObject, scene); // spawn new objects for player if (owner != null) { ServerObjectManager.SpawnVisibleObjects(Identity.Owner); } }