Network Project Config
Overview
Network Project Config
is an asset that contains a variety of information and parameters that affect the associated Photon Fusion project such as:
- Version;
- Peer Mode;
- Default Player Count;
- Network Condition Testing;
- Encryption;
- Prefab Inspection.
This asset is located under Assets/Photon/Fusion/Resources/NetworkProject.Config.fusion
. You can also access this by selecting Tools > Fusion > NetworkProjectConfig
from the top Unity Editor menu. Any changes to this asset must be applied, so make sure to click the Apply button near the bottom of the Inspector to do so or confirm to save changes when prompted.
Fusion Version
This first section lists what version of Fusion is currently being used. When expanded, the dropdown shows more detailed information about each dynamic-link library (DLL
) used by Fusion.
Scene Settings
Peer mode
:Single
: the normal use case in which the build or editor runs a single server, host, or client peer.Multiple
: allows multiple peers in the editor.
Setting Peer Mode
to Multiple
can be useful for testing multiple peers within a Game Session without having to make a build.
You can read more about Multi-Peer Mode here.
Lag Compensation
Enabling Lag Compensation
allows hitbox detection to be more accurate to what players are seeing currently and very useful for fast-paced games such as first-person shooters. This is done by storing a set of snapshots of the game's hitboxes. These settings let users define how much information is stored within each snapshot, affecting the hitbox detection's accuracy.
Server Mode
and Host Mode
Hitbox Buffer Length In Ms
: specifies the length buffer in which hitbox data will be stored in milliseconds; the longer the time, the longer hitbox snapshots will be stored before being overwritten by new ones.Hitbox Default Capacity
: the default number of hitbox values stored per snapshot. Has a minimum of 16.Cached Static Colliders Size
: the size of the cached static colliders (PhysX or Box2D) array of the defaultLag Compensation
Queries.
You can read more about Lag Compensation here.
Miscellaneous
This section contains settings that handle miscellaneous parameters regarding Fusion projects.
Enqueue Incomplete Synchronous Spawns
: if enabled, synchronous incomplete spawns (Addressables, etc.) get enqueued instead of throwing an exception. They will instead returnFusion.NetworkSpawnStatus.Queued
and an attempt to spawn the object will occur on the next frame. Enabling this can be useful for transitioning from Fusion 1.x.Invoke Render In Batch Mode
: if this is enabled,Fusion.SimulationBehaviour.Render
callbacks will be invoked when playing a game in Batch Mode. Batch mode refers to the-batchmode
parameter that can be passed to the Unity build executable. Disabling this may be useful for a game using a headless server that is run in Batch Mode. You can read more about Unity's Batch Mode here.Network Id Is Object Name
: when checked, the name of newly spawned objects will be modified to include the Network Id in them as follows:[Network Id] Original Object Name
.Hide Network Object Inactivity Guard
: nested insideNetworkObjects
, a GameObject namedNetworkObjectInactivityGuard
tracks the OnDestroy message ofNetworkObjects
that are destroyed before being activated. If this option is checked, these guards will not be visible in the hierarchy.
Simulation
The following settings handle how the Fusion Simulation behaves:
Replication Features
:None
: this is ideal if the project never exceeds per tick data limits during gameplay.Scheduling
: the default. ForNetwork Objects
not replicated by the server to a client due to culling (as the data per tick limit was reached) the server increases the priority of thatNetwork Object
for the next outgoingTick
update to that client.Scheduling and Interest Management
: in addition to scheduling,Interest Management
features are enabled, bothArea of Interest
andExplicit Interest
. You can read more about Interest Management here.
Input Transfer Mode
determines how input is transferred over the network:Redundancy
: send delta compressed and redundant input, used for most games.Latest State
: only send the latest input state. Useful for games that utilize large input structs such as VR, which often contain positional data for the head and hands.
Player Count
: ranging from 1 to 255, this is the default player count that will be used if one is not specific when starting a new Fusion session.
Shared Mode
, in which the Client Tick Rate
is always 32, and the Client Send Rate
is always 16.Client Tick Rate
: the tick rate of clients. This utilizes a dropdown with values ranging from 8 to 256.Client Send Rate
: the rate at which the client sends data to the server, and can be set to the following:1/8
: only applicable if the Client Tick Rate is 240 or higher.1/4
: only applicable if the Client Rate is divisible by 4.1/2
.1:1
: or the same value as Client Tick Rate.
Server Tick Rate
: the rate at which the server is updated. This will have the same choices asClient Send Rate
.Server Send Rate
: the rate at which the server sends data to the other clients in ticks. This will have the same choices asClient Send Rate
, but it cannot be higher than the Server Tick Rate.
Network
Connection Timeout
: amount of time, in seconds, before a disconnect will occur if no updates are received. Servers will disconnect clients if no updates are received from said client; clients will disconnect from the server if there is no update received from said server.Connecting Shutdown Time
: amount of time, in seconds, after a connection status changes to Shutdown, and the connection and its associated references are released.
Reliable Data Transfer Modes
: determines the reliable data transfer modes.Client to Server
: allows data to be reliably transferred from clients to the server.Client to Client With Server Proxy
: allows data to be reliably from Client to Client, using the Server as proxy.
Host Migration
These settings affect how Host Migration behaves.
Enable Auto Update
: if checked, host migration will be updated automatically.Update Delay
: time, in seconds, between Host Migration Snapshots are uploaded to the Photon Cloud.
Encryption
This toggle sets if Encryption
should be enabled or disabled for this Fusion project. Note, you must check this and update the project's Encryption Mode
in the Photon App Settings
.
You can read more about encryption here.
Network Conditions
Network Conditions allow users to simulate and test different network conditions such as latency and loss.
Enabled
: if checked, more options will appear.Delay Shape
sets the pattern of the delay oscillation:Noise
;Sine
;Square
;Triangle
;Saw
;Reverse Saw
.
Delay Min
: minimum delay, in seconds, ranging from 0 to 0.5.Delay Max
: maximum delay, in seconds, ranging from 0 to 0.5.Delay Period
: rate at which the delay will oscillate in seconds betweenDelay Min
andDelay Max
.Delay Threshold
: when the oscillation falls below this value, which ranges from 0 to 1, the delay will be set toDelay Min
.Additional Jitter
: after the oscillator determines the next delay value, a random value ranging from 0 to this in seconds will be added to the delay.Loss Chance Shape
: sets the pattern of the loss oscillation. Choices are identical toDelay Shape
Loss Chance Min
: the lowest chance value that a loss will occur, ranging from 0 (0%) to 1 (100%).Loss Chance Max
: the highest chance value that a loss will occur, ranging from 0 (0%) to 1 (100%).Loss Chance Threshold
: when the oscillation falls below this value, which ranges from 0 to 1, the delay will be set toLoss Chance Min
.Loss Chance Period
: the rate at which the loss chance oscillate betweenLoss Chance Min
andLoss Chance Max
in seconds.Additional Loss
: after the oscillator determines the next loss chance value, an additional random value ranging from 0 to this (normalized) percentage of loss chance is added.
Loss has nearly identical settings; instead of the amount of time in seconds, the values determine the percentage, ranging from 0% to 100%, that a loss will be simulated.
Heap
Allows users to define an amount of preallocated memory for use with Fusion, which helps with optimizing memory management and improving efficiency.
Page Shift
: determines the size of eachHeap Page
, which impacts the granularity of memory allocation. It ranges from 1 KB to 256 KB at powers of 2. A lower shift results in smaller memory allocations, while a higher shift allows for larger allocations.Page Count
: specifies the initial number of pages allocated for the heap. Ranging from 16 to 4096, this defines the number of pages allocated for the heap and influences the total, initial memory allocated.
Weaver Settings
These are settings that affect the Fusion IL Weaver, which is used to generate low-level netcode and inject it into the Assembly-CSharp.dll
.
Assemblies to Weave
: list of assemblies that are going to be weaved. They are not case sensitive. By default, these following are included:Fusion.Unity
;Assemble-CSharp
;Assembly-CSharp-firstpass
;Fusion.Addons.Physics
(if the project is using Fusion's physics systems).
Use Serialized Dictionary
: if checked,Fusion.SerializeableDictionary
will be used to store the initial value of Networked Properties. If unchecked, weaver will useSystem.Generic.Dictionary
instead; though this type is not Unity-serializable, custom serializers such as Odin may support it.Null Checks for Networked Properties
: if set, the weaver will add a check if anyFusion.NetworkBehaviour
with Networked properties have an associated Fusion.NetworkObject attached to them.Check Rpc Attribute Usage
: if set, the weaver will check ifFusion.RpcAttribute
is used in types that do not support it. For example, ifFusion.RpcAttribute
is added to aUnity.MonoBehaviour
method and this is checked, a warning will be logged, specifying that RPCs can only be added toFusion.NetworkBehaviour
andFusion.SimulatedBehaviours
; however, requires all types to be scanned and can increase weaving and script compilation time.You can read more about rules regarding RPCs here.Check Networked Properties Being Empty
: if checked, users will get a warning if they try to define a property with theFusion.NetworkedAttribute
improperly. The getters and setters for these properties should be empty, such as with the following:
C#
[Networked]
public int NetworkedProperty {get; set;}
You can read more about setting up Networked Properties properly here.
Prefabs
These two settings handle how prefabs are unloaded.
Unload Prefab On Releasing Last Instance
: if true, prefabs will be unloaded when the last instance is released.Unload Prefabs On Shutdown
: if true, all prefabs will be unloaded on shutdown.
Unloading prefabs no longer needed can help improve memory usage but will require them to be reloaded if needed again.
Auto-Generated
This section shows off automatically generated information.
Show Network Prefab Inspector
: opens up a window, allowing users to look at the different prefabs in the project that contain aFusion.NetworkObject
component and haveFusion.NetworkObject.IsSpawnable
enabled.Prefabs
: below the previously mentioned button is a dropdown list of each prefab that would be listedNetworkObject
prefab in the project. This list cannot be updated by the user directly; however, additional prefabs can be registered at runtime withFusion.NetworkPrefabTable.TryAddSource
.Behaviour Meta
: an auto-generated list containing meta information about all theFusion.SimulationBehaviours
in the project such as execution order.
Network Prefabs Inspector
As previously mentioned, the Network Prefabs Inspector
allows users to inspect prefabs that contain a Fusion.NetworkObject
component and have Fusion.NetworkObject.IsSpawnable
enabled in more detail.
The main toolbar of this window has the following functionality:
Refresh
: refreshes the list and updates it if any new prefabs are made;Sync Selection
: if turned on, Unity will select the prefab asset that is highlighted in the window;Loaded Only
: if turned on, only prefabs that are loaded will be displayed.
Each row presents a different prefab; each column in this window represents the following:
State
: shows whether or not the prefab is currently loaded.Type
: shows what kind of prefab this object is, referring to how it will be loaded.R
: A prefab placed in aResources
folder;SL
: A static prefab placed outside of aResources
folder;A
: A prefab loaded as anAddressable
(not pictured.)
PrefabId
: the id assigned to the prefab by Fusion.Path
: the file path to the prefab.