Fusion: Load Scene For Master Client (Shared Mode)

Options
Webkostya
Webkostya
edited July 2022 in Fusion

Create Room (Shared Mode). OnConnectedToServer -> OnPlayerJoined (spawn player) -> Load New Scene = Spawn Player Not Moved To New Scene 😥

Joined Room (Shared Mode). OnConnectedToServer -> Load New Scene -> OnPlayerJoined (spawn player) -> GOOD ! 😀

How to do joining after load scene ?

HELP 😭

Comments

  • Isaac_Augusto
    Options

    Hi,

    The player prefab is being destroyed because it spawned on the unloaded scene. There's some ways to avoid that problem, an obvious one is to make the player prefab DontDestroyOnLoad, but that's hardly something you want.

    There's no need to spawn the player on the OnJoined callback, you can have a networked behaviour on the scene you want to load that act as a spawner, and on Spawned() method it spawns the player prefab.

    In shared mode, is common to each player spawn it own character prefab. By the way, you don't need to pass an input authority (input authority does nothing on shared mode, as each client is the state authority over it own character, but of course you can pass the local player if you want to).

    // On a spawner class that is present on the scene that you want to load.
    
    Spawned(){
      Runner.spawn(playerPrefab, position, rotation, Runner.LocalPlayer)
    }
    

    -----

    Isaac Augusto

    Photon Fusion Team

  • Webkostya
    Webkostya
    edited June 2022
    Options

    It works ! Thank you ! 🤟

    Example:


This discussion has been closed.