Photon Fusion 2.1.1

NetworkProjectConfig Class Reference

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

Public Types

enum  FusionHubMode
 The current mode of the Fusion Hub. More...
enum  InvokeRenderModes
enum  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  ReplicationFeatures

Public Member Functions

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

Static Public Member Functions

static NetworkProjectConfig Deserialize (string data)
 De-serialize a NetworkProjectConfig from a JSON string (typically sent by the Room's Creator).
static string Serialize (NetworkProjectConfig config)
 Serialize a NetworkProjectConfig into a JSON string.
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.

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.
bool AllowMasterClientReassignRequest = false
 Allows for non-master clients to request to be elected the new master client.
string[] AssembliesToWeave
 Names of assemblies Fusion is going to weave. Not case sensitive. Assemblies that have.
bool CheckNetworkedPropertiesBeingEmpty = false
 If set, the weaver will check if NetworkedAttribute properties getters and setters are empty.
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.
bool ClientsRecordFrameAndPacketTimingTraces = false
 When this setting is enabled, each client will record its frame and packet timing information to a local file (one file per session). Timing issues depend on many external factors, which makes them difficult to intentionally reproduce. But if an issue can be captured once, its trace can be used to simulate and troubleshoot it more effectively.
bool DoNotSetForecastDisabledProxyRigidbodiesToKinematic = false
 When true, the rigidbodys for proxy objects will not be set to kinematic when Forecast Physics is disabled. Setting this to false is for compatibility with Fusion 2.0 behaviour and is otherwise not recommended. PhysicsSettings.SetForecastDisabledProxyRigidbodiesToKinematic.
EncryptionConfig EncryptionConfig = new EncryptionConfig()
 Reference to EncryptionConfig settings for this NetworkProjectConfig.
bool EnqueueIncompleteSynchronousSpawns
 This flag changes the behaviour of NetworkRunner.Spawn to return null (instead of throwing an exception) and NetworkRunner.TrySpawn 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.
HeapConfiguration Heap = new HeapConfiguration()
 Heap Settings.
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.
HostMigrationConfig HostMigration = new HostMigrationConfig()
 Reference to HostMigration settings for this NetworkProjectConfig.
FusionHubMode HubMode = 0
 Current mode the Fusion Hub is using.
InvokeRenderModes InvokeRenderMode = InvokeRenderModes.Always
 Signal if the SimulationBehaviour.Render callbacks should be invoked.
LagCompensationSettings LagCompensation = new LagCompensationSettings()
 Advanced lag compensation buffer settings.
float MasterClientRequestReassignThreshold = 2f
 Threshold time, in seconds, that the current master client must be without responding before other clients can request to be promoted to master.
NetworkConfiguration Network = new NetworkConfiguration()
 Reference to NetworkConfiguration settings for this NetworkProjectConfig.
NetworkSimulationConfiguration NetworkConditions = new NetworkSimulationConfiguration()
 Settings for simulating network conditions of latency and loss.
bool NetworkIdIsObjectName
 Signal if the NetworkId of the NetworkObject should be included on the name of the GameObject.
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.
PeerModes PeerMode
 Setting for whether multiple peers can run per Unity instance (typically to allow easy testing of multiple peers inside of the editor).
bool PhysicsForecast = false
 Global Configuration for NetworkTransform Forecast Physics. This must be set to true to allow any Forecast Physics extrapolation. When set to false Physics is synchronised to all proxies in remote time instead. When true Forecast Physics is controlled per Network Transform by PhysicsSettings.ForecastEnabled.
NetworkPrefabTable PrefabTable = new NetworkPrefabTable()
 Reference to the NetworkPrefabTable instance for this NetworkProjectConfig.
SimulationConfig Simulation = new SimulationConfig()
 Reference to SimulationConfig settings for this NetworkProjectConfig.
TimeSyncConfiguration TimeSync = new TimeSyncConfiguration()
 Reference to the TimeSyncConfiguration settings for this NetworkProjectConfig.
string TypeId = CurrentTypeId
 Current NetworkProjectConfig Type ID.
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.
int Version = CurrentVersion
 Current NetworkProjectConfig version.

Static Public Attributes

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

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.
bool InvokeRenderInBatchMode [get]

Detailed Description

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

Member Enumeration Documentation

◆ FusionHubMode

The current mode of the Fusion Hub.

Enumerator
None 

No Mode selected yet > open popup to select on open.

Beginner 

Beginner content only.

Advanced 

All hub content.

◆ InvokeRenderModes

Enumerator
NotInBatchMode 

Render will not be invoked when running batch mode.

Always 

Render will always be invoked.

NotInEditorAsServer 

Render will not be invoked when running as Serve while in Unity Editor.

NotInBatchModeAndEditorAsServer 

NotInBatchMode and NotInEditorAsServer combined.

◆ PeerModes

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

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

State replication options for NetworkObject.

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

Enumerator
None 

No special replication handling. This setting is simplest, but does not allow using Interest to reduce bandwidth.

InterestManagement 

Interest Management features are also enabled (Area Of Interest and Explicit Interest), allows more management of bandwidth.

Member Function Documentation

◆ Deserialize()

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()

string Serialize ( NetworkProjectConfig config)
static

Serialize a NetworkProjectConfig into a JSON string.

Parameters
configNetworkProjectConfig reference
Returns
JSON String

Member Data Documentation

◆ AssembliesToWeave

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

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

FUSION_FORCE_WEAVING

define defined will always be weaved.