Recently connected players don't instantiate PhotonNetwork.Instantiate objects?

Is there a way to do this? I want players that recently joined a room to don't instantiate objects instantiated by PhotonNetwork, my players may be in different scenes so I don't always want these objects instantiated in all players.

Is it possible to do this?

Best Answer

  • Rodolfo_Rubens
    edited May 2017 Answer ✓
    http://forum.photonengine.com/discussion/9253/photonnetwork-instantiate-different-scenes

    But I think I found a way around this.

    Edit: Okay, seems like destroying objects left on another scene by the first players that joined the room is not prohibited and gives no errors so I created an enum with two values:
    SceneType.Game
    SceneType.Menu,

    In the GameController class (that persists during the entire playing session) I declared:
    public static SceneType currentSceneType;

    This tells which scene type we are in and updates everytime a new scene loads.

    Then, if a gameObject is spawned and has a class that checks this currentSceneType value in GameController, if we are in the wrong scene type for that game obejct we just destroy it.

Answers

  • Up! Anyone?
  • So I assume there is no way to do this?
  • Rodolfo_Rubens
    edited May 2017 Answer ✓
    http://forum.photonengine.com/discussion/9253/photonnetwork-instantiate-different-scenes

    But I think I found a way around this.

    Edit: Okay, seems like destroying objects left on another scene by the first players that joined the room is not prohibited and gives no errors so I created an enum with two values:
    SceneType.Game
    SceneType.Menu,

    In the GameController class (that persists during the entire playing session) I declared:
    public static SceneType currentSceneType;

    This tells which scene type we are in and updates everytime a new scene loads.

    Then, if a gameObject is spawned and has a class that checks this currentSceneType value in GameController, if we are in the wrong scene type for that game obejct we just destroy it.