PurrNet
  • 🐈Introduction
    • ‼️Unique to PurrNet
    • 💲Pricing
    • 💻Compatibility
    • 📚Addon library
    • 🗺️Roadmap
    • 🏎️Performance
      • RPC Benchmarks
      • Network Transform benchmarks
    • 🥰Support PurrNet
  • 📚Guides
    • Installation/Setup
    • Getting Started
    • Converting to PurrNet
      • Converting from Mirror
      • Converting from FishNet
    • Lobby System
    • Networking custom classes, structs & types
    • Chat system with broadcasts
    • Easy Multiplayer Physics (input Sync)
  • 🎮Full game guides
    • 🔫First Person Shooter
    • 🪓Survival Game
  • 🖥️Systems and modules
    • Network Manager
      • Network Rules
      • Network Prefabs
      • Network Visibility
        • Distance condition
      • Transports
        • Composite Transport
        • UDP Transport
        • Web Transport
        • Local Transport
        • Steam Transport
        • Purr Transport
      • Authentication
    • PlayerID (Client connection)
    • Network Identity
      • NetworkBehaviour
      • Ownership
      • Sync Types
        • SyncVar
        • SyncList
        • SyncArray
        • SyncQueue
        • SyncDictionary
        • SyncEvent
        • SyncHashset
        • SyncTimer
      • Don't destroy on load
    • Network Modules
    • Collider Rollback
    • Client Side Prediction
      • Overview
      • Predicted Identities
      • Predicted Hierarchy
      • Best Practices
      • Input Handling
      • State Handling
    • Plug n' play components
      • Network Transform
      • Network Animator
      • Network Reflection (Auto Sync)
      • State Machine (Auto Networked)
    • Spawning & Despawning
    • Remote Procedure Call (RPC)
      • Generic RPC
      • Static RPC
      • Awaitable RPC
      • Direct Local Execution of RPCs
    • Instance Handler
    • Scene Management
    • Broadcast
  • 🤓Terminology
    • Early Access
    • Channels
    • Client Auth/Everyone (Unsafe)
    • Host
    • Server Auth (Safe)
  • 💡Integrations
    • Dissonance
    • Cozy Weather
Powered by GitBook
On this page
  • Loading Scenes
  • PurrSceneSettings
  • Unloading scenes
  1. Systems and modules

Scene Management

PreviousInstance HandlerNextBroadcast

Last updated 4 months ago

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!

Loading Scenes

For ease of use, you can simply call the LoadSceneAsync with the scene name as a string, or the scene id.

//Loads scene with default settings
networkManager.sceneModule.LoadSceneAsync("sceneName");

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:

//Loads scene with custom settings
var settings = new PurrSceneSettings();
settings.isPublic = true; //Default setting - Has all connections automatically switch scene
settings.mode = LoadSceneMode.Single; //Default setting - Unloads all other scenes
networkManager.sceneModule.LoadSceneAsync("sceneName", settings);

PurrSceneSettings

The PurrSceneSettings is a struct of setting for your scene loading. This has the following values:

  • isPublic : Whether the scene automatically pulls all players into the scene or not

Unloading scenes

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.

networkManager.sceneModule.UnloadSceneAsync("sceneName");

mode : The Unity , so whether it should be additive or single

physicsMode : The Unity to load with

The are a Unity class, which by default is None when using the UnloadSceneAsync.

🖥️
SceneLoadMode
LocalPhysicsMode
UnloadSceneOptions
Overloads for the LoadSceneAsync
Overloads for UnloadSceneAsync