Photon Fusion 1.1.11

Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Properties | List of all members
NetworkProjectConfig Class Reference

The core Fusion config file that is shared with all peers at startup. More...

Public Types

enum class  DeltaCompressors
 Delta Compression Implementations More...
 
enum class  PeerModes
 Options for running one or multiple peers in one Unity instance. Multiple is useful for testing multiple players/clients inside of the Unity editor without needing to build executables. Each peer is assigned its own independent physics scene and NetworkRunner instance. More...
 
enum class  PhysicsEngines
 Options for which Physics engines Fusion will use for simulations. More...
 
enum class  PhysicsModes
 Options for how physics is simulated on clients. More...
 
enum class  SceneLoadSpawnModes
 Spawn Modes while Scene is being loaded More...
 

Public Member Functions

delegate NetworkProjectConfigAsset AssetLoadingDelegate ()
 GlobalAssetLoading More...
 
delegate void AssetUndloadingDelegate (NetworkProjectConfigAsset asset)
 GlobalAssetUnloading More...
 
override string ToString ()
 ToString() implementation. More...
 

Static Public Member Functions

static LocalPhysicsMode ConvertPhysicsMode (NetworkProjectConfig.PhysicsEngines engine)
 Convert between NetworkProjectConfig.PhysicsEngines to LocalPhysicsMode More...
 
static NetworkProjectConfig Deserialize (string data)
 De-serialize a NetworkProjectConfig from a JSON string (typically sent by the Room's Creator). More...
 
static string Serialize (NetworkProjectConfig config)
 Serialize a NetworkProjectConfig into a JSON string. More...
 
static void UnloadGlobal ()
 Unloads Global, if already loaded. If loading Global has faulted, resets the state and next call to the Global accessor will attempt to load the config again. More...
 

Public Attributes

AccuracyDefaults AccuracyDefaults = new AccuracyDefaults()
 The named global accuracies used by this project. More...
 
string[] AssembliesToWeave
 Names of assemblies Fusion is going to weave. Not case sensitive. More...
 
bool CheckNetworkedPropertiesBeingEmpty = false
 If set, the weaver will check if NetworkedAttribute properties getters and setters are empty. More...
 
bool CheckRpcAttributeUsage = false
 If set, the weaver will check if RpcAttribute is used in types that do not support it. This requires all types to be scanned and can increase weaving duration. More...
 
DeltaCompressors DeltaCompressor
 Current DeltaCompressor type. More...
 
bool EnableHostMigration = false
 Enable support for Host Migration. More...
 
HeapConfiguration Heap = new HeapConfiguration()
 Heap Settings More...
 
bool HideNetworkObjectInactivityGuard = false
 Inactive NetworkObject need special handling in case they get destroyed without ever being activated. This is achieved with adding a nested GameObject called "NetworkObjectInactivityGuard" that tracks the OnDestroy message. HideNetworkObjectInactivityGuard can be used to control whether these guards are visible in the hierarchy or not. More...
 
uint HostMigrationSnapshotInterval = 60
 Delay in seconds between each time the Host sends a Snapshot of the current Simulation State, for use in Host Migration. More...
 
InterpolationConfiguration Interpolation = new InterpolationConfiguration()
 Reference to InterpolationConfiguration settings for this NetworkProjectConfig. More...
 
bool InvokeRenderInBatchMode = true
 Signal if the SimulationBehaviour.Render callbacks should be invoked in Batch Mode. More...
 
LagCompensationSettings LagCompensation = new LagCompensationSettings()
 Advanced lag compensation buffer settings. More...
 
ushort MaxNetworkedObjectCount = 1 << 13
 Max number of allowed NetworkObjects in a room. More...
 
NetworkConfiguration Network = new NetworkConfiguration()
 Reference to NetworkConfiguration settings for this NetworkProjectConfig. More...
 
NetworkSimulationConfiguration NetworkConditions = new NetworkSimulationConfiguration()
 Settings for simulating network conditions of latency and loss. More...
 
bool NetworkIdIsObjectName
 Signal if the NetworkId of the NetworkObject should be included on the name of the GameObject. More...
 
bool NullChecksForNetworkedProperties = true
 If set, the weaver will add a check to all [Networked] properties on each NetworkBehaviour to verify if owing NetworkObject has been attached to. More...
 
PeerModes PeerMode
 Setting for whether multiple peers can run per Unity instance (typically to allow easy testing of multiple peers inside of the editor). More...
 
PhysicsEngines PhysicsEngine
 Setting for which physics engine Fusion will simulate with. More...
 
NetworkPrefabTable PrefabTable = new NetworkPrefabTable()
 Reference to the NetworkPrefabTable instance for this NetworkProjectConfig. More...
 
SceneLoadSpawnModes SceneLoadSpawnMode = SceneLoadSpawnModes.NotAllowed
 Current SceneLoadSpawnMode. More...
 
PhysicsModes ServerPhysicsMode
 Setting for which ServerPhysicsMode Fusion will use in server or host mode. Not used in shared mode. More...
 
SimulationConfig Simulation = new SimulationConfig()
 Reference to SimulationConfig settings for this NetworkProjectConfig. More...
 
string TypeId = CurrentTypeId
 Current NetworkProjectConfig Type ID More...
 
bool UseLagCompensation = true
 Use lag compensation. Not used in shared mode. More...
 
bool UseSerializableDictionary = true
 Use Fusion.SerializableDictionary to store [Networked] dictionary properties initial value. If unchecked, the weaver will emit System.Generic.Dictionary instead - a type that's not Unity-serializable, but custom serializers (e.g. Odin) may support it. More...
 
int Version = CurrentVersion
 Current NetworkProjectConfig version More...
 

Static Public Attributes

static NetworkRunner. BuildTypes
 Get the version information for the Fusion.Runntime.dll. More...
 
const string CurrentTypeId = nameof(NetworkProjectConfig)
 Current NetworkProjectConfig Type ID More...
 
const int CurrentVersion = 1
 Current NetworkProjectConfig version More...
 
const string DefaultResourceName = nameof(NetworkProjectConfig)
 Default file name for the NetworkProjectConfig asset More...
 

Properties

static NetworkProjectConfig Global [get]
 Reference for the default NetworkProjectConfig More...
 
static AssetLoadingDelegate GlobalAssetLoading
 Invoked when a config is a about to be loaded from a default location (a Resource DefaultResourceName). If the event returns a non-null value, it will accepted as the config source and no attempt to load the default asset will be made. More...
 
static AssetUndloadingDelegate GlobalAssetUnloading
 Invoked when a config is about to be unloaded (due to UnloadGlobal). More...
 

Detailed Description

The core Fusion config file that is shared with all peers at startup.

Member Enumeration Documentation

◆ DeltaCompressors

enum DeltaCompressors
strong

Delta Compression Implementations

Enumerator
Managed 

Default Implementation.

Burst 

Burst Implementation.

DebugUncompressed 

Debug Implementation without compression. NOT FOR GENERAL USE.

◆ PeerModes

enum PeerModes
strong

Options for running one or multiple peers in one Unity instance. Multiple is useful for testing multiple players/clients inside of the Unity editor without needing to build executables. Each peer is assigned its own independent physics scene and NetworkRunner instance.

Enumerator
Single 

This is the normal use case, where every build and the editor run a single server, host or client peer.

Multiple 

This is the optional use case, which allows running multiple peers in the Unity editor, or in a build.

◆ PhysicsEngines

enum PhysicsEngines
strong

Options for which Physics engines Fusion will use for simulations.

Enumerator
Physics3D 

The Unity PhysX simulation is used, but auto-simulation is disabled and simulations are controlled by Fusion.

Physics2D 

The Unity Box2D simulation is used, but auto-simulation is disabled and simulations are controlled by Fusion.

None 

Fusion preforms no Physics Simulate() calls.

◆ PhysicsModes

enum PhysicsModes
strong

Options for how physics is simulated on clients.

PhysicsModes.ServerOnly - Clients do not predict remote objects, and render in their remote time frame (relative past).
PhysicsModes.ClientPrediction - Clients predict remote objects and have options for rendering them in local and/or remote time frames.

Enumerator
ServerOnly 

The server simulates and sends states to all clients. Clients do not attempt prediction and will render remote objects in the server (relative past) time frame.

ClientPrediction 

The server simulates and sends states to all clients. Clients simulate remote states forward into the local time frame (prediction).

◆ SceneLoadSpawnModes

enum SceneLoadSpawnModes
strong

Spawn Modes while Scene is being loaded

Enumerator
NotAllowed 

Block all Spawns

Allowed 

Allow all Spawns

Queued 

Queue spawn for when Scene is fully loaded

Member Function Documentation

◆ AssetLoadingDelegate()

delegate NetworkProjectConfigAsset AssetLoadingDelegate ( )

◆ AssetUndloadingDelegate()

delegate void AssetUndloadingDelegate ( NetworkProjectConfigAsset  asset)

◆ ConvertPhysicsMode()

static LocalPhysicsMode ConvertPhysicsMode ( NetworkProjectConfig.PhysicsEngines  engine)
static

Convert between NetworkProjectConfig.PhysicsEngines to LocalPhysicsMode

◆ Deserialize()

static NetworkProjectConfig Deserialize ( string  data)
static

De-serialize a NetworkProjectConfig from a JSON string (typically sent by the Room's Creator).

Parameters
dataJSON string of a serialized NetworkProjectConfig
Returns
NetworkProjectConfig reference de-serialized from JSON string

◆ Serialize()

static string Serialize ( NetworkProjectConfig  config)
static

Serialize a NetworkProjectConfig into a JSON string.

Parameters
configNetworkProjectConfig reference
Returns
JSON String

◆ ToString()

override string ToString ( )

ToString() implementation.

◆ UnloadGlobal()

static void UnloadGlobal ( )
static

Unloads Global, if already loaded. If loading Global has faulted, resets the state and next call to the Global accessor will attempt to load the config again.

Member Data Documentation

◆ AccuracyDefaults

The named global accuracies used by this project.

◆ AssembliesToWeave

string [] AssembliesToWeave
Initial value:
= new string[] {
"Assembly-CSharp", "Assembly-CSharp-firstpass"
}

Names of assemblies Fusion is going to weave. Not case sensitive.

◆ BuildTypes

NetworkRunner. BuildTypes
static

Get the version information for the Fusion.Runntime.dll.

◆ CheckNetworkedPropertiesBeingEmpty

bool CheckNetworkedPropertiesBeingEmpty = false

If set, the weaver will check if NetworkedAttribute properties getters and setters are empty.

◆ CheckRpcAttributeUsage

bool CheckRpcAttributeUsage = false

If set, the weaver will check if RpcAttribute is used in types that do not support it. This requires all types to be scanned and can increase weaving duration.

◆ CurrentTypeId

const string CurrentTypeId = nameof(NetworkProjectConfig)
static

Current NetworkProjectConfig Type ID

◆ CurrentVersion

const int CurrentVersion = 1
static

Current NetworkProjectConfig version

◆ DefaultResourceName

const string DefaultResourceName = nameof(NetworkProjectConfig)
static

Default file name for the NetworkProjectConfig asset

◆ DeltaCompressor

DeltaCompressors DeltaCompressor

Current DeltaCompressor type.

◆ EnableHostMigration

bool EnableHostMigration = false

Enable support for Host Migration.

◆ Heap

Heap Settings

◆ HideNetworkObjectInactivityGuard

bool HideNetworkObjectInactivityGuard = false

Inactive NetworkObject need special handling in case they get destroyed without ever being activated. This is achieved with adding a nested GameObject called "NetworkObjectInactivityGuard" that tracks the OnDestroy message. HideNetworkObjectInactivityGuard can be used to control whether these guards are visible in the hierarchy or not.

◆ HostMigrationSnapshotInterval

uint HostMigrationSnapshotInterval = 60

Delay in seconds between each time the Host sends a Snapshot of the current Simulation State, for use in Host Migration.

◆ Interpolation

InterpolationConfiguration Interpolation = new InterpolationConfiguration()

Reference to InterpolationConfiguration settings for this NetworkProjectConfig.

◆ InvokeRenderInBatchMode

bool InvokeRenderInBatchMode = true

Signal if the SimulationBehaviour.Render callbacks should be invoked in Batch Mode.

◆ LagCompensation

Advanced lag compensation buffer settings.

◆ MaxNetworkedObjectCount

ushort MaxNetworkedObjectCount = 1 << 13

Max number of allowed NetworkObjects in a room.

◆ Network

Reference to NetworkConfiguration settings for this NetworkProjectConfig.

◆ NetworkConditions

Settings for simulating network conditions of latency and loss.

◆ NetworkIdIsObjectName

bool NetworkIdIsObjectName

Signal if the NetworkId of the NetworkObject should be included on the name of the GameObject.

◆ NullChecksForNetworkedProperties

bool NullChecksForNetworkedProperties = true

If set, the weaver will add a check to all [Networked] properties on each NetworkBehaviour to verify if owing NetworkObject has been attached to.

◆ PeerMode

PeerModes PeerMode

Setting for whether multiple peers can run per Unity instance (typically to allow easy testing of multiple peers inside of the editor).

◆ PhysicsEngine

PhysicsEngines PhysicsEngine

Setting for which physics engine Fusion will simulate with.

◆ PrefabTable

NetworkPrefabTable PrefabTable = new NetworkPrefabTable()

Reference to the NetworkPrefabTable instance for this NetworkProjectConfig.

◆ SceneLoadSpawnMode

◆ ServerPhysicsMode

PhysicsModes ServerPhysicsMode

Setting for which ServerPhysicsMode Fusion will use in server or host mode. Not used in shared mode.

◆ Simulation

Reference to SimulationConfig settings for this NetworkProjectConfig.

◆ TypeId

string TypeId = CurrentTypeId

Current NetworkProjectConfig Type ID

◆ UseLagCompensation

bool UseLagCompensation = true

Use lag compensation. Not used in shared mode.

◆ UseSerializableDictionary

bool UseSerializableDictionary = true

Use Fusion.SerializableDictionary to store [Networked] dictionary properties initial value. If unchecked, the weaver will emit System.Generic.Dictionary instead - a type that's not Unity-serializable, but custom serializers (e.g. Odin) may support it.

◆ Version

int Version = CurrentVersion

Current NetworkProjectConfig version

Property Documentation

◆ Global

NetworkProjectConfig Global
staticget

Reference for the default NetworkProjectConfig

◆ GlobalAssetLoading

AssetLoadingDelegate GlobalAssetLoading
staticaddremove

Invoked when a config is a about to be loaded from a default location (a Resource DefaultResourceName). If the event returns a non-null value, it will accepted as the config source and no attempt to load the default asset will be made.

◆ GlobalAssetUnloading

AssetUndloadingDelegate GlobalAssetUnloading
staticaddremove

Invoked when a config is about to be unloaded (due to UnloadGlobal).