Photon Fusion 2.0.4

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...

Inherits IConfigurationSanityCheck.

Public Types

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  ReplicationFeatures
 

Public Member Functions

int? GetExecutionOrder (Type type)
 Get the execution order for a given type. If the type is registered, returns null. More...
 
void SanityCheck ()
 
override string ToString ()
 ToString() implementation. More...
 

Static Public Member Functions

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

bool AllowClientServerModesInWebGL = false
 Allow the use of Client-Server modes in WebGL builds. This is not recommended, as it can lead to degraded performance. Client-Server modes are not supported in WebGL builds by default, this setting allows its usage despite the limitations. Read more about the limitations of WebGL builds in the Fusion documentation at https://doc.photonengine.com/fusion/v2/fusion-intro. 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...
 
EncryptionConfig EncryptionConfig = new EncryptionConfig()
 Reference to EncryptionConfig settings for this NetworkProjectConfig More...
 
bool EnqueueIncompleteSynchronousSpawns
 This flag changes the behaviour of NetworkRunner.Spawn<T> to return null (instead of throwing an exception) and NetworkRunner.TrySpawn<T>) to return NetworkSpawnStatus.Queued if Fusion was unable to load a prefab synchronously (e.g. because it was Addressable). Fusion will enqueue the spawn and attempt to perform it the next frame, until successful. Useful for transition from Fusion 1.x. 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...
 
HostMigrationConfig HostMigration = new HostMigrationConfig()
 Reference to HostMigration 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...
 
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...
 
NetworkPrefabTable PrefabTable = new NetworkPrefabTable()
 Reference to the NetworkPrefabTable instance for this NetworkProjectConfig. More...
 
SimulationConfig Simulation = new SimulationConfig()
 Reference to SimulationConfig settings for this NetworkProjectConfig. More...
 
TimeSyncConfiguration TimeSynchronizationOverride
 this can be used to override the time synchronization from code More...
 
string TypeId = CurrentTypeId
 Current NetworkProjectConfig Type ID 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. By default, loads a resource named "NetworkProjectConfig". This behaviour can be changed with an attribute FusionGlobalScriptableObjectLoaderMethodAttribute. More...
 

Detailed Description

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

Member Enumeration Documentation

◆ 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.

◆ ReplicationFeatures

enum ReplicationFeatures
strong

Eventual Consistency NetworkObject state replication options.

Scheduling enables automatic prioritization of objects when culling occurs (when Object's are not replicated due to exceeding per tick data limits, they increase in priority on the following Tick).

Interest Management enables NetworkObject Area Of Interest and Explicit Interest features.

Enumerator
None 

No special replication handling. This setting is ideal if your project never exceeds per tick data limits during gameplay.

Scheduling 

When changed Network Objects are not replicated by the server to a client due to culling (data per tick limit was reached) the server increases the priority of that Network Object for the next outgoing Tick update to that client.

SchedulingAndInterestManagement 

In addition to scheduling, Interest Management features are also enabled (Area Of Interest and Explicit Interest).

Member Function Documentation

◆ 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

◆ GetExecutionOrder()

int? GetExecutionOrder ( Type  type)

Get the execution order for a given type. If the type is registered, returns null.

Parameters
typeType to check for the execution order.
Returns
Execution order for the type, or null if not registered.

◆ 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

◆ AllowClientServerModesInWebGL

bool AllowClientServerModesInWebGL = false

Allow the use of Client-Server modes in WebGL builds. This is not recommended, as it can lead to degraded performance. Client-Server modes are not supported in WebGL builds by default, this setting allows its usage despite the limitations. Read more about the limitations of WebGL builds in the Fusion documentation at https://doc.photonengine.com/fusion/v2/fusion-intro.

◆ AssembliesToWeave

string [] AssembliesToWeave
Initial value:
= new string[] {
"Fusion.Unity",
"Assembly-CSharp",
"Assembly-CSharp-firstpass",
"Fusion.Addons.Physics",
"Fusion.Addons.FSM",
}

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

◆ EncryptionConfig

Reference to EncryptionConfig settings for this NetworkProjectConfig

◆ EnqueueIncompleteSynchronousSpawns

bool EnqueueIncompleteSynchronousSpawns

This flag changes the behaviour of NetworkRunner.Spawn<T> to return null (instead of throwing an exception) and NetworkRunner.TrySpawn<T>) to return NetworkSpawnStatus.Queued if Fusion was unable to load a prefab synchronously (e.g. because it was Addressable). Fusion will enqueue the spawn and attempt to perform it the next frame, until successful. Useful for transition from Fusion 1.x.

◆ 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.

◆ HostMigration

Reference to HostMigration 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.

◆ 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).

◆ PrefabTable

Reference to the NetworkPrefabTable instance for this NetworkProjectConfig.

◆ Simulation

Reference to SimulationConfig settings for this NetworkProjectConfig.

◆ TimeSynchronizationOverride

TimeSyncConfiguration TimeSynchronizationOverride

this can be used to override the time synchronization from code

◆ TypeId

string TypeId = CurrentTypeId

Current NetworkProjectConfig Type ID

◆ 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. By default, loads a resource named "NetworkProjectConfig". This behaviour can be changed with an attribute FusionGlobalScriptableObjectLoaderMethodAttribute.