Scene Module
Last updated
Last updated
Using the Scene Module in PurrNet is as easy as changing scene with Unity's default scene manager. But there is also some more depth to understanding the logic of players in scenes.
Scene management needs to be handled on the Server, so everything below is needed to be read with that context!
For ease of use, you can simply call the LoadSceneAsync
with the scene name as a string, or the scene id.
There are multiple overloads to the LoadSceneAsync
method (see image below), such as directly setting the load mode directly, using Unity LoadSceneParameters
, or adding custom PurrNet settings.
You can also load a scene with custom scene settings called PurrSceneSettings
, see example below:
The PurrSceneSettings
is a struct of setting for your scene loading. This has the following values:
mode : The Unity SceneLoadMode, so whether it should be additive or single
physicsMode : The Unity LocalPhysicsMode to load with
isPublic : Whether the scene automatically pulls all players into the scene or not
Unloading scenes with PurrNet is as easy as calling the unload of the scene, similar to Unity's own scene management. This will unload the scene for all clients in the scene, as well as the server.
The UnloadSceneOptions are a Unity class, which by default is None when using the UnloadSceneAsync.