Photon Fusion 2.0.3

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

Host Migration related code in order to get a copy of the Simulation State More...

Inherits Behaviour, and Simulation.ICallbacks.

Public Types

enum class  BuildTypes
 Enumeration of Fusion.Runtime.dll options. More...
 
enum class  States
 Initialization stages of Fusion More...
 

Public Member Functions

void AddCallbacks (params INetworkRunnerCallbacks[] callbacks)
 Register an INetworkRunnerCallbacks instance for callbacks from this NetworkRunner. More...
 
void AddGlobal (SimulationBehaviour instance)
 Add and register a SimulationBehaviour to this NetworkRunner. Note: It should NOT be a NetworkBehaviour More...
 
void AddPlayerAreaOfInterest (PlayerRef player, Vector3 center, float radius)
 Call this every FixedUpdateNetwork to add an area of interest for a player. Should only be called from the Host/Server in Server client mode. Should only be called for the local player in shared mode. More...
 
void Attach (NetworkObject networkObject, PlayerRef? inputAuthority=null, bool allocate=true, bool? masterClientObjectOverride=null)
 Attaches a user-created network object to the network. More...
 
void Attach (NetworkObject[] networkObjects, PlayerRef? inputAuthority=null, bool allocate=true, bool? masterClientObjectOverride=null)
 Attach and assign to this NetworkRunner the NetworkObject provided. Used internally from the default implementation of INetworkSceneManager to register scene objects. More...
 
void ClearPlayerAreaOfInterest (PlayerRef player)
 Clears the area of interest for a player. This can only be called from the server/host More...
 
delegate void CloudConnectionLostHandler (NetworkRunner networkRunner, ShutdownReason shutdownReason, bool reconnecting)
 If this callback is implemented, the default behavior of disconnecting when the cloud connection is lost in server/client or host/client mode is disabled. This callback will be invoked instead, leaving the decision up to the user. It is called both on the server/host and on the client. More...
 
void Despawn (NetworkObject networkObject)
 Destroys a NetworkObject. More...
 
void DestroySingleton< T > ()
 Removes a specific SimulationBehaviour from this NetworkRunner gameobject, if it exists. More...
 
void Disconnect (PlayerRef player, byte[] token=null)
 Disconnects a player from the server. More...
 
bool EnsureRunnerSceneIsActive (out Scene previousActiveScene)
 Ensures the scene of this runner is active and returns the previous active scene More...
 
bool Exists (NetworkId id)
 Returns if the Fusion.Simulation contains a NetworkObject with given id in the current State. More...
 
bool Exists (NetworkObject obj)
 Returns if the Fusion.Simulation contains a reference to a NetworkObject in the current State. More...
 
NetworkObject FindObject (NetworkId networkId)
 Get the NetworkObject instance for this NetworkRunner from a NetworkId. More...
 
SimulationBehaviour[] GetAllBehaviours (Type type)
 Returns an array of all SimulationBehaviour instances registered with this NetworkRunner. More...
 
List< T > GetAllBehaviours< T > ()
 Get a list with all behaviours of the desired type that are registered on the NetworkRunner. More...
 
void GetAllBehaviours< T > (List< T > result)
 Add on the list all behaviours of the desired type that are registered on the NetworkRunner. Note: The list will not be cleared before adding the results. More...
 
List< NetworkObjectGetAllNetworkObjects ()
 Retrieves a list of all network objects in the simulation. More...
 
void GetAllNetworkObjects (List< NetworkObject > result)
 Populate a list with all network objects in the simulation. More...
 
void GetAreaOfInterestGizmoData (List<(Vector3 center, Vector3 size, int playerCount, int objectCount)> result)
 Populates the provided list with data about the current Area of Interest (AOI) cells. Each element in the list represents one AOI cell. More...
 
T? GetInputForPlayer< T > (PlayerRef player)
 Returns the NetworkInput data from player, converted to the indicated INetworkInput. More...
 
SimulationBehaviourListScope GetInterfaceListHead (Type type, int index, out SimulationBehaviour head)
 Get the interface list head. More...
 
SimulationBehaviour GetInterfaceListNext (SimulationBehaviour behaviour)
 Get the next behaviour More...
 
SimulationBehaviour GetInterfaceListPrev (SimulationBehaviour behaviour)
 Get the previous behaviour More...
 
int GetInterfaceListsCount (Type type)
 Get the number of interfaces of the desired type that are registered on the behaviour updater. More...
 
void GetMemorySnapshot (MemoryStatisticsSnapshot.TargetAllocator targetAllocator, ref MemoryStatisticsSnapshot snapshot)
 Gets a memory snapshot of the simulation. More...
 
List< NetworkIdGetObjectsInAreaOfInterestForPlayer (PlayerRef player)
 Retrieves a list of network object IDs that are in the area of interest for the specified player. Server only. More...
 
PhysicsScene GetPhysicsScene ()
 Get the 3D Physics scene being used by this Runner. More...
 
PhysicsScene2D GetPhysicsScene2D ()
 Get the 2D Physics scene being used by this Runner. More...
 
int? GetPlayerActorId (PlayerRef player)
 Gets Player's Actor Number (ID). More...
 
byte[] GetPlayerConnectionToken (PlayerRef player=default)
 Returns a copy of the Connection Token used by a Player when connecting to this Server. Only available on Server. It will return null if running on a Client or the Connection token is missing More...
 
ConnectionType GetPlayerConnectionType (PlayerRef player)
 Return the ConnectionType with a Remote PlayerRef. Valid only when invoked from a Server (NetworkRunner.IsServer) More...
 
NetworkObject GetPlayerObject (PlayerRef player)
 Gets the network object associated with a specific player More...
 
double GetPlayerRtt (PlayerRef playerRef)
 Returns the player round trip time (ping) in seconds More...
 
string GetPlayerUserId (PlayerRef player=default)
 Gets Player's UserID. More...
 
NetworkInputGetRawInputForPlayer (PlayerRef player)
 Returns the unconverted unsafe NetworkInput for the indicated player. More...
 
IEnumerable< NetworkObjectGetResumeSnapshotNetworkObjects ()
 Iterate over the old NetworkObjects from the Resume Snapshot More...
 
IEnumerable<(NetworkObject, NetworkObjectHeaderPtr)> GetResumeSnapshotNetworkSceneObjects ()
 Iterate over the Scene NetworkObjects from the Resume Snapshot while giving the reference of the old Snapshot data associated with that particular Scene Object More...
 
RpcTargetStatus GetRpcTargetStatus (PlayerRef target)
 Return the RpcTargetStatus for a specific player. More...
 
SceneRef GetSceneRef (GameObject gameObj)
 
SceneRef GetSceneRef (string sceneNameOrPath)
 
GetSingleton< T > ()
 Ensures that a specific SimulationBehaviour component exists on this NetworkRunner gameobject. More...
 
bool HasAnyActiveConnections ()
 
bool HasSingleton< T > ()
 Returns if a given SimulationBehaviour is present in this NetworkRunner gameobject. More...
 
GameObject InstantiateInRunnerScene (GameObject original)
 Instantiates an object in the scene of this runner More...
 
GameObject InstantiateInRunnerScene (GameObject original, Vector3 position, Quaternion rotation)
 Instantiates an object in the scene of this runner More...
 
InstantiateInRunnerScene< T > (T original)
 Instantiates an object in the scene of this runner More...
 
InstantiateInRunnerScene< T > (T original, Vector3 position, Quaternion rotation)
 Instantiates an object in the scene of this runner More...
 
void InvokeSceneLoadDone (in SceneLoadDoneArgs info)
 Invoke INetworkRunnerCallbacks.OnSceneLoadDone(NetworkRunner) on all implementations More...
 
void InvokeSceneLoadStart (SceneRef sceneRef)
 Invoke INetworkRunnerCallbacks.OnSceneLoadStart(NetworkRunner) on all implementations More...
 
bool? IsInterestedIn (NetworkObject obj, PlayerRef player)
 Test if a player has Interest in a NetworkObject. More...
 
bool IsPlayerValid (PlayerRef player)
 Checks if the provided player is valid in the current simulation. More...
 
async Task< StartGameResultJoinSessionLobby (SessionLobby sessionLobby, string lobbyID=null, AuthenticationValues authentication=null, FusionAppSettings customAppSettings=null, bool? useDefaultCloudPorts=false, CancellationToken cancellationToken=default, bool useCachedRegions=true)
 Join the Peer to a specific Lobby, either a prebuild or a custom one. More...
 
NetworkSceneAsyncOp LoadScene (SceneRef sceneRef, LoadSceneMode loadSceneMode=LoadSceneMode.Single, LocalPhysicsMode localPhysicsMode=LocalPhysicsMode.None, bool setActiveOnLoad=DefaultSetActiveOnLoad)
 Loads a scene More...
 
NetworkSceneAsyncOp LoadScene (SceneRef sceneRef, LoadSceneParameters parameters, bool setActiveOnLoad=DefaultSetActiveOnLoad)
 
NetworkSceneAsyncOp LoadScene (string sceneName, LoadSceneMode loadSceneMode=LoadSceneMode.Single, LocalPhysicsMode localPhysicsMode=LocalPhysicsMode.None, bool setActiveOnLoad=DefaultSetActiveOnLoad)
 Loads a scene More...
 
NetworkSceneAsyncOp LoadScene (string sceneName, LoadSceneParameters parameters, bool setActiveOnLoad=DefaultSetActiveOnLoad)
 Loads a scene More...
 
void MakeDontDestroyOnLoad (GameObject obj)
 Mark an object as DontDestroyOnLoad. More...
 
bool MoveGameObjectToSameScene (GameObject gameObj, GameObject other)
 Moves a GameObject to the same scene as another GameObject More...
 
bool MoveGameObjectToScene (GameObject gameObj, SceneRef sceneRef)
 Moves a GameObject to a specific scene More...
 
void MoveToRunnerScene (GameObject instance, SceneRef? targetSceneRef=null)
 Moves an object to the scene of this runner More...
 
void MoveToRunnerScene< T > (T component)
 Moves an object to the scene of this runner More...
 
delegate void ObjectDelegate (NetworkRunner runner, NetworkObject obj)
 Delegate type for object callback More...
 
delegate void OnBeforeSpawned (NetworkRunner runner, NetworkObject obj)
 Delegate type for on before spawned callback More...
 
async Task< bool > PushHostMigrationSnapshot ()
 Compute and send a Host Migration Snapshot to the Photon Cloud More...
 
int RegisterSceneObjects (SceneRef scene, NetworkObject[] objects, NetworkSceneLoadId loadId=default)
 Registers scene objects to the network. More...
 
void ReleaseStateAuthority (NetworkId id)
 Releases state authority for a given NetworkId on shared mode. More...
 
void RemoveCallbacks (params INetworkRunnerCallbacks[] callbacks)
 Unregister an INetworkRunnerCallbacks instance for callbacks from this NetworkRunner. More...
 
void RemoveGlobal (SimulationBehaviour instance)
 Removes a specific SimulationBehaviour from this NetworkObject gameobject, if it exists. More...
 
void RenderInternal ()
 This method is meant to be called by INetworkRunnerUpdater. More...
 
void RequestStateAuthority (NetworkId id)
 Requests state authority for a specified NetworkId on shared mode. More...
 
void SendReliableDataToPlayer (PlayerRef player, ReliableKey key, byte[] data)
 Sends a reliable data buffer to a target player. More...
 
void SendReliableDataToServer (ReliableKey key, byte[] data)
 Sends a reliable data buffer to the server. More...
 
void SendRpc (SimulationMessage *message)
 Sends RPC message. Not meant to be used directly, ILWeaver calls this. More...
 
void SendRpc (SimulationMessage *message, out RpcSendResult info)
 Sends RPC message. Not meant to be used directly, ILWeaver calls this. More...
 
void SetAreaOfInterestCellSize (int size)
 Set the area of interest cell size More...
 
void SetAreaOfInterestGrid (int x, int y, int z)
 Set the area of interest grid dimensions More...
 
void SetBehaviourReplicateTo (NetworkBehaviour behaviour, PlayerRef player, bool replicate)
 Controls if a specific network behaviours state is replicated to a player or not More...
 
void SetBehaviourReplicateToAll (NetworkBehaviour behaviour, bool replicate)
 Controls if a specific network behaviours state is replicated to all players or not More...
 
bool SetIsSimulated (NetworkObject obj, bool simulate)
 Sets the simulation state for this object, if it takes part in the NetworkFixedUpdate, etc. More...
 
void SetMasterClient (PlayerRef player)
 Promote a player to be the new master client. Only the master client is able to call this method More...
 
void SetPlayerAlwaysInterested (PlayerRef player, NetworkObject networkObject, bool alwaysInterested)
 Flags this player as always interested in this object. Means it does not have to be in a players area of interest to be replicated. Only the NetworkObject State Authority can set interest. More...
 
void SetPlayerObject (PlayerRef player, NetworkObject networkObject)
 Sets the network object associated with this player More...
 
void SetSimulateMultiPeerPhysics (bool value)
 Set the value for simulating physics scenes when using multi-peer. Restores the default physics simulation settings if false, overrides the default if true. (2D: SimulationMode2D.Script | 3D: AutoSimulation = false) More...
 
Task Shutdown (bool destroyGameObject=true, ShutdownReason shutdownReason=ShutdownReason.Ok, bool forceShutdownProcedure=false)
 Initiates a Simulation.Dispose. More...
 
void SinglePlayerContinue ()
 Continues a paused game in single player More...
 
void SinglePlayerPause ()
 Pauses the game in single player More...
 
void SinglePlayerPause (bool paused)
 Sets the paused state in a single player More...
 
NetworkObject Spawn (GameObject prefab, Vector3? position=null, Quaternion? rotation=null, PlayerRef? inputAuthority=null, OnBeforeSpawned onBeforeSpawned=null, NetworkSpawnFlags flags=default)
 Attempts to network instantiate a NetworkObject using a GameObject. The supplied GameObject must have a NetworkObject component. More...
 
NetworkObject Spawn (NetworkObject prefab, Vector3? position=null, Quaternion? rotation=null, PlayerRef? inputAuthority=null, OnBeforeSpawned onBeforeSpawned=null, NetworkSpawnFlags flags=default)
 Attempts to network instantiate a NetworkObject using a NetworkObject prefab. Note: position and rotation values are only used locally for the instantiation of the object, and are not inherently networked. Use NetworkTransform (or any custom class derived from NetworkTRSP) to replicate the initial transform state. More...
 
NetworkObject Spawn (NetworkObjectGuid prefabGuid, Vector3? position=null, Quaternion? rotation=null, PlayerRef? inputAuthority=null, OnBeforeSpawned onBeforeSpawned=null, NetworkSpawnFlags flags=default)
 Attempts to network instantiate a NetworkObject using a NetworkObjectGuid Note: position and rotation values are only used locally for the instantiation of the object, and are not inherently networked. Use NetworkTransform (or any custom class derived from NetworkTRSP) to replicate the initial transform state. More...
 
NetworkObject Spawn (NetworkPrefabId typeId, Vector3? position=null, Quaternion? rotation=null, PlayerRef? inputAuthority=null, OnBeforeSpawned onBeforeSpawned=null, NetworkSpawnFlags flags=default)
 Attempts to network instantiate a NetworkObject using a NetworkPrefabId Note: position and rotation values are only used locally for the instantiation of the object, and are not inherently networked. Use NetworkTransform (or any custom class derived from NetworkTRSP) to replicate the initial transform state. More...
 
NetworkObject Spawn (NetworkPrefabRef prefabRef, Vector3? position=null, Quaternion? rotation=null, PlayerRef? inputAuthority=null, OnBeforeSpawned onBeforeSpawned=null, NetworkSpawnFlags flags=default)
 Attempts to network instantiate a NetworkObject using a NetworkPrefabRef. Note: position and rotation values are only used locally for the instantiation of the object, and are not inherently networked. Use NetworkTransform (or any custom class derived from NetworkTRSP) to replicate the initial transform state. More...
 
Spawn< T > (T prefab, Vector3? position=null, Quaternion? rotation=null, PlayerRef? inputAuthority=null, OnBeforeSpawned onBeforeSpawned=null, NetworkSpawnFlags flags=default)
 Attempts to network instantiate a NetworkObject using a Component type that is part of a NetworkObject More...
 
NetworkSpawnOp SpawnAsync (GameObject prefab, Vector3? position=null, Quaternion? rotation=null, PlayerRef? inputAuthority=null, OnBeforeSpawned onBeforeSpawned=null, NetworkSpawnFlags flags=default, NetworkObjectSpawnDelegate onCompleted=null)
 Attempts to network instantiate a NetworkObject using a GameObject. The supplied GameObject must have a NetworkObject component. More...
 
NetworkSpawnOp SpawnAsync (NetworkObject prefab, Vector3? position=null, Quaternion? rotation=null, PlayerRef? inputAuthority=null, OnBeforeSpawned onBeforeSpawned=null, NetworkSpawnFlags flags=default, NetworkObjectSpawnDelegate onCompleted=null)
 Attempts to network instantiate a NetworkObject using a NetworkObject prefab. Note: position and rotation values are only used locally for the instantiation of the object, and are not inherently networked. Use NetworkTransform (or any custom class derived from NetworkTRSP) to replicate the initial transform state. More...
 
NetworkSpawnOp SpawnAsync (NetworkObjectGuid prefabGuid, Vector3? position=null, Quaternion? rotation=null, PlayerRef? inputAuthority=null, OnBeforeSpawned onBeforeSpawned=null, NetworkSpawnFlags flags=default, NetworkObjectSpawnDelegate onCompleted=null)
 Attempts to network instantiate a NetworkObject using a NetworkObjectGuid Note: position and rotation values are only used locally for the instantiation of the object, and are not inherently networked. Use NetworkTransform (or any custom class derived from NetworkTRSP) to replicate the initial transform state. More...
 
NetworkSpawnOp SpawnAsync (NetworkPrefabId typeId, Vector3? position=null, Quaternion? rotation=null, PlayerRef? inputAuthority=null, OnBeforeSpawned onBeforeSpawned=null, NetworkSpawnFlags flags=default, NetworkObjectSpawnDelegate onCompleted=null)
 Attempts to network instantiate a NetworkObject using a NetworkPrefabId Note: position and rotation values are only used locally for the instantiation of the object, and are not inherently networked. Use NetworkTransform (or any custom class derived from NetworkTRSP) to replicate the initial transform state. More...
 
NetworkSpawnOp SpawnAsync (NetworkPrefabRef prefabRef, Vector3? position=null, Quaternion? rotation=null, PlayerRef? inputAuthority=null, OnBeforeSpawned onBeforeSpawned=null, NetworkSpawnFlags flags=default, NetworkObjectSpawnDelegate onCompleted=null)
 Attempts to network instantiate a NetworkObject using a NetworkPrefabRef. Note: position and rotation values are only used locally for the instantiation of the object, and are not inherently networked. Use NetworkTransform (or any custom class derived from NetworkTRSP) to replicate the initial transform state. More...
 
NetworkSpawnOp SpawnAsync< T > (T prefab, Vector3? position=null, Quaternion? rotation=null, PlayerRef? inputAuthority=null, OnBeforeSpawned onBeforeSpawned=null, NetworkSpawnFlags flags=default, NetworkObjectSpawnDelegate onCompleted=null)
 Attempts to network instantiate a NetworkObject using a Component type that is part of a NetworkObject More...
 
Task< StartGameResultStartGame (StartGameArgs args)
 Starts the local Fusion Runner and takes care of all major setup necessary More...
 
bool TryFindBehaviour (NetworkBehaviourId behaviourId, out NetworkBehaviour behaviour)
 Get the NetworkBehaviour instance for this NetworkRunner from a NetworkBehaviourId. More...
 
bool TryFindBehaviour< T > (NetworkBehaviourId id, out T behaviour)
 Try to find a NetworkBehaviour with the provided NetworkBehaviourId. More...
 
bool TryFindObject (NetworkId objectId, out NetworkObject networkObject)
 Get the NetworkObject instance for this NetworkRunner from a NetworkId. More...
 
bool TryGetBehaviourStatistics (Type behaviourType, out BehaviourStatisticsSnapshot behaviourStatisticsSnapshot)
 Tries to get the statistics snapshot for a specified behaviour type. More...
 
bool TryGetFusionStatistics (out FusionStatisticsManager statisticsManager)
 Tries to get the FusionStatisticsManager from the simulation. More...
 
bool TryGetInputForPlayer< T > (PlayerRef player, out T input)
 Outputs the NetworkInput from player, translated to the indicated INetworkInput. More...
 
TryGetNetworkedBehaviourFromNetworkedObjectRef< T > (NetworkId networkId)
 Tries to return the first instance of T found on the root of a NetworkObject. More...
 
NetworkBehaviourId TryGetNetworkedBehaviourId (NetworkBehaviour behaviour)
 Tries to return a NetworkBehaviourId for the NetworkBehaviour provided. More...
 
NetworkId TryGetObjectRefFromNetworkedBehaviour (NetworkBehaviour behaviour)
 Tries to return the behaviour NetworkId. More...
 
bool TryGetPhysicsInfo (out NetworkPhysicsInfo info)
 Try to get the physics info. More...
 
bool TryGetPlayerObject (PlayerRef player, out NetworkObject networkObject)
 Try to gets the NetworkObject associated with a specific player More...
 
bool TryGetSceneInfo (out NetworkSceneInfo sceneInfo)
 Tries to get the NetworkSceneInfo of this NetworkRunner. More...
 
bool TrySetPhysicsInfo (NetworkPhysicsInfo info)
 Try to set the physics info. More...
 
NetworkSpawnStatus TrySpawn (GameObject prefab, out NetworkObject obj, Vector3? position=null, Quaternion? rotation=null, PlayerRef? inputAuthority=null, OnBeforeSpawned onBeforeSpawned=null, NetworkSpawnFlags flags=default)
 Attempts to network instantiate a NetworkObject using a GameObject. The supplied GameObject must have a NetworkObject component. More...
 
NetworkSpawnStatus TrySpawn (NetworkObject prefab, out NetworkObject obj, Vector3? position=null, Quaternion? rotation=null, PlayerRef? inputAuthority=null, OnBeforeSpawned onBeforeSpawned=null, NetworkSpawnFlags flags=default)
 Attempts to network instantiate a NetworkObject using a NetworkObject prefab. Note: position and rotation values are only used locally for the instantiation of the object, and are not inherently networked. Use NetworkTransform (or any custom class derived from NetworkTRSP) to replicate the initial transform state. More...
 
NetworkSpawnStatus TrySpawn (NetworkObjectGuid prefabGuid, out NetworkObject obj, Vector3? position=null, Quaternion? rotation=null, PlayerRef? inputAuthority=null, OnBeforeSpawned onBeforeSpawned=null, NetworkSpawnFlags flags=default)
 Attempts to network instantiate a NetworkObject using a NetworkObjectGuid Note: position and rotation values are only used locally for the instantiation of the object, and are not inherently networked. Use NetworkTransform (or any custom class derived from NetworkTRSP) to replicate the initial transform state. More...
 
NetworkSpawnStatus TrySpawn (NetworkPrefabId typeId, out NetworkObject obj, Vector3? position=null, Quaternion? rotation=null, PlayerRef? inputAuthority=null, OnBeforeSpawned onBeforeSpawned=null, NetworkSpawnFlags flags=default)
 Attempts to network instantiate a NetworkObject using a NetworkPrefabId Note: position and rotation values are only used locally for the instantiation of the object, and are not inherently networked. Use NetworkTransform (or any custom class derived from NetworkTRSP) to replicate the initial transform state. More...
 
NetworkSpawnStatus TrySpawn (NetworkPrefabRef prefabRef, out NetworkObject obj, Vector3? position=null, Quaternion? rotation=null, PlayerRef? inputAuthority=null, OnBeforeSpawned onBeforeSpawned=null, NetworkSpawnFlags flags=default)
 Attempts to network instantiate a NetworkObject using a NetworkPrefabRef. Note: position and rotation values are only used locally for the instantiation of the object, and are not inherently networked. Use NetworkTransform (or any custom class derived from NetworkTRSP) to replicate the initial transform state. More...
 
NetworkSpawnStatus TrySpawn< T > (T prefab, out T obj, Vector3? position=null, Quaternion? rotation=null, PlayerRef? inputAuthority=null, OnBeforeSpawned onBeforeSpawned=null, NetworkSpawnFlags flags=default)
 Attempts to network instantiate a NetworkObject using a Component type that is part of a NetworkObject More...
 
NetworkSceneAsyncOp UnloadScene (SceneRef sceneRef)
 
NetworkSceneAsyncOp UnloadScene (string sceneName)
 Unloads a scene More...
 
void UpdateInternal (double dt)
 This method is meant to be called by INetworkRunnerUpdater. More...
 
- Public Member Functions inherited from Behaviour
AddBehaviour< T > ()
 Wrapper for Unity's GameObject.AddComponent() More...
 
GetBehaviour< T > ()
 Wrapper for Unity's GameObject.GetComponentInChildren() More...
 
bool TryGetBehaviour< T > (out T behaviour)
 Wrapper for Unity's GameObject.TryGetComponent() More...
 

Static Public Member Functions

static Task< List< RegionInfo > > GetAvailableRegions (string appId=default, CancellationToken cancellationToken=default)
 Starts an operation to retrieves the list of available regions. More...
 
static List< NetworkRunner >.Enumerator GetInstancesEnumerator ()
 Get enumerator for the collection of all NetworkRunners. Allows to enumerate alloc-free. More...
 
static NetworkRunner GetRunnerForGameObject (GameObject gameObject)
 Get the NetworkRunner a GameObject instance belongs to. More...
 
static NetworkRunner GetRunnerForScene (Scene scene)
 Get the NetworkRunner from a specific Scene More...
 
- Static Public Member Functions inherited from Behaviour
static void DestroyBehaviour (Behaviour behaviour)
 Wrapper for Unity's GameObject.Destroy() More...
 

Public Attributes

Func< string, ServerConnection, string > CloudAddressRewriter = null
 

Static Public Attributes

static CloudConnectionLostHandler CloudConnectionLost
 

Properties

IEnumerable< PlayerRefActivePlayers [get]
 Returns the collection of PlayerRef objects for this NetworkRunner's Fusion.Simulation. More...
 
ref Simulation.AreaOfInterestState AreaOfInterest [get]
 The AreaOfInterest state of the Runner. Can be used for read access to interest management data. More...
 
AuthenticationValues AuthenticationValues [get]
 AuthenticationValues used by this Runner to Authenticate the local peer. More...
 
static BuildTypes BuildType [get]
 Get Fusion.Runtime.dll build type. More...
 
bool CanSpawn [get]
 Signal if the Network Runner can spawn a NetworkObject More...
 
NetworkProjectConfig Config [get]
 Returns the NetworkProjectConfig reference. More...
 
ConnectionType CurrentConnectionType [get]
 Check the current Connection Type with the Remote Server More...
 
float DeltaTime [get]
 Returns the fixed tick time interval. Derived from the SimulationRuntimeConfig.TickRate. More...
 
GameMode GameMode [get]
 Current Game Mode active on the Fusion Simulation More...
 
static IReadOnlyList< NetworkRunnerInstances [get]
 A list of all NetworkRunners. More...
 
bool IsClient [get]
 Returns if this Fusion.Simulation represents a Client connection. More...
 
bool IsCloudReady [get]
 Signal if the Local Peer is connected to Photon Cloud and is able to Create/Join Room but also receive Lobby Updates More...
 
bool IsConnectedToServer [get]
 Returns if this Client is currently connected to a Remote Server More...
 
bool IsFirstTick [get]
 If this is the first tick that executes this update or re-simulation More...
 
bool IsForward [get]
 If this is not a re-simulation but a new forward tick More...
 
bool IsInSession [get]
 
bool IsLastTick [get]
 If this is the last tick that is being executed this update More...
 
bool IsPlayer [get]
 Returns true if this runner represents a Client or Host. Dedicated servers have no local player and will return false. More...
 
bool IsResimulation [get]
 If we are currently executing a client side prediction re-simulation. More...
 
bool IsResume [get]
 if this instance is a resume (host migration) More...
 
bool IsRunning [get]
 Returns if this Fusion.Simulation is valid and running. More...
 
bool IsSceneAuthority [get]
 Is this runner responsible for scene management. More...
 
bool? IsSceneManagerBusy [get]
 Signals if the INetworkSceneManager instance assigned to this NetworkRunner is busy with any scene loading operation. More...
 
bool IsServer [get]
 Returns if this Fusion.Simulation represents a Server connection. More...
 
bool IsSharedModeMasterClient [get]
 Signal if the Local Peer is in a Room and is the Room Master Client More...
 
bool IsShutdown [get]
 If the runner is shutdown More...
 
bool IsSimulationUpdating [get]
 Is the runner updating the simulation. More...
 
bool IsSinglePlayer [get]
 Returns true if this runner was started as single player (Started as SimulationModes.Host with SimulationConfig.PlayerCount = 1). More...
 
bool IsStarting [get]
 If the runner is pending to start More...
 
HitboxManager LagCompensation [get]
 Returns the global instance of a lag compensation buffer Fusion.HitboxManager. More...
 
Tick LatestServerTick [get]
 Get the latest confirmed tick of the server we are aware of More...
 
LobbyInfo LobbyInfo = new LobbyInfo() [get]
 Signal if the local peer is already inside a Lobby More...
 
float LocalAlpha [get]
 Get the local time alpha value More...
 
PlayerRef LocalPlayer [get]
 Returns a PlayerRef for the local simulation. For a dedicated server PlayerRef.IsRealPlayer will equal false. PlayerRefs are assigned in order from 0 to MaxPlayers-1 and are re-used as players join and leave. The only caveat is that the server player (if one exists), always gets the last index no matter how many clients are connected. More...
 
float??? LocalRenderTime [get]
 The current time (current State.Time + Simulation.DeltaTime) for predicted objects (objects in the local time frame). Use as an equivalent to Unity's Time.time. Time is relative to Tick 0 (which represents Time 0f). More...
 
SimulationModes Mode [get]
 Returns the SimulationModes flags for The type of network peer the associated Fusion.Simulation represents. More...
 
NATType NATType [get]
 Exposes the current NAT Type from the local Peer More...
 
INetworkObjectProvider ObjectProvider [get]
 Returns the INetworkObjectProvider instance. More...
 
NetworkPrefabTable Prefabs [get]
 Reference to the NetworkPrefabTable. More...
 
bool ProvideInput [get, set]
 Indicates if this NetworkRunner is collecting PlayerRef INetworkInput. More...
 
int???? ReliableDataSendRate [get, set]
 
float RemoteRenderTime [get]
 The current time (current State.Time + Simulation.DeltaTime) for non-predicted objects (objects in a remote time frame). Use as an equivalent to Unity's Time.time. Time is relative to Tick 0 (which represents Time 0f). More...
 
INetworkSceneManager SceneManager [get]
 Returns the INetworkSceneManager instance. More...
 
SessionInfo SessionInfo = new SessionInfo() [get]
 Stores information about the current running session More...
 
float SimulationTime [get]
 The time the current State represents (the most recent FixedUpdateNetwork simulation). Use as an equivalent to Unity's Time.fixedTime. Time is relative to Tick 0 (which represents Time 0f). More...
 
Scene??? SimulationUnityScene [get]
 The main scene of the NetworkRunner or default if not running. More...
 
SimulationStages Stage [get]
 Returns the current SimulationStages stage of this Fusion.Simulation. More...
 
States State [get]
 The current state of the runner, if it's Starting, Running, Shutdown More...
 
Tick??? Tick [get]
 The tick associated with the current state of networked objects, or the current simulation tick being processed (when evaluated during FixedUpdateNetwork). More...
 
int TickRate [get]
 
int TicksExecuted [get]
 Returns how many ticks we executed last update. More...
 
Topologies Topology [get]
 The current topology used More...
 
string UserId [get]
 Photon Client UserID More...
 

Events

ObjectDelegate ObjectAcquired
 Event for object acquired More...
 

Detailed Description

Host Migration related code in order to get a copy of the Simulation State

All Scene related API and fields

Represents a Server or Client Simulation.

Member Enumeration Documentation

◆ BuildTypes

enum BuildTypes
strong

Enumeration of Fusion.Runtime.dll options.

Enumerator
Debug 

Use the Debug version of the Fusion.Runntime.dll.

Release 

Use the Debug version of the Fusion.Runntime.dll.

◆ States

enum States
strong

Initialization stages of Fusion

Enumerator
Starting 

Runner is about to start

Running 

Runner is running

Shutdown 

Runner is shutdown

Member Function Documentation

◆ AddCallbacks()

void AddCallbacks ( params INetworkRunnerCallbacks[]  callbacks)

Register an INetworkRunnerCallbacks instance for callbacks from this NetworkRunner.

Parameters
callbacksCallbacks to register

◆ AddGlobal()

void AddGlobal ( SimulationBehaviour  instance)

Add and register a SimulationBehaviour to this NetworkRunner. Note: It should NOT be a NetworkBehaviour

◆ AddPlayerAreaOfInterest()

void AddPlayerAreaOfInterest ( PlayerRef  player,
Vector3  center,
float  radius 
)

Call this every FixedUpdateNetwork to add an area of interest for a player. Should only be called from the Host/Server in Server client mode. Should only be called for the local player in shared mode.

◆ Attach() [1/2]

void Attach ( NetworkObject  networkObject,
PlayerRef inputAuthority = null,
bool  allocate = true,
bool?  masterClientObjectOverride = null 
)

Attaches a user-created network object to the network.

Parameters
networkObjectThe network object to attach. Must not be null and must have a valid NetworkTypeId.
inputAuthorityOptional PlayerRef. If assigned, it will be the default input authority for this object.
allocateOptional boolean. If true, the object will be allocated in memory and attached to the scene object. Default is true.
masterClientObjectOverrideOptional boolean. If provided, it will override the master client object setting. Default is null.
Exceptions
ArgumentNullExceptionThrown when the provided network object is null.
ArgumentExceptionThrown when the provided network object has an invalid NetworkTypeId.

◆ Attach() [2/2]

void Attach ( NetworkObject[]  networkObjects,
PlayerRef inputAuthority = null,
bool  allocate = true,
bool?  masterClientObjectOverride = null 
)

Attach and assign to this NetworkRunner the NetworkObject provided. Used internally from the default implementation of INetworkSceneManager to register scene objects.

◆ ClearPlayerAreaOfInterest()

void ClearPlayerAreaOfInterest ( PlayerRef  player)

Clears the area of interest for a player. This can only be called from the server/host

◆ CloudConnectionLostHandler()

delegate void CloudConnectionLostHandler ( NetworkRunner  networkRunner,
ShutdownReason  shutdownReason,
bool  reconnecting 
)

If this callback is implemented, the default behavior of disconnecting when the cloud connection is lost in server/client or host/client mode is disabled. This callback will be invoked instead, leaving the decision up to the user. It is called both on the server/host and on the client.

Parameters
networkRunnerNetworkRunner instance
shutdownReasonShutdown reason for the connection loss
reconnectingFlag to signal if the peer is attempting to reconnect to the Photon Cloud

◆ Despawn()

void Despawn ( NetworkObject  networkObject)

Destroys a NetworkObject.

Parameters
networkObjectThe NetworkObject to be destroyed.

This method checks if the local simulation has state authority over the NetworkObject. If it does, it checks if the NetworkObject exists and has state authority. If these conditions are met, it destroys the NetworkObject.

Exceptions
InvalidOperationExceptionThrown when the NetworkObject does not belong to this runner.

◆ DestroySingleton< T >()

void DestroySingleton< T > ( )

Removes a specific SimulationBehaviour from this NetworkRunner gameobject, if it exists.

Type Constraints
T :SimulationBehaviour 

◆ Disconnect()

void Disconnect ( PlayerRef  player,
byte[]  token = null 
)

Disconnects a player from the server.

Parameters
playerThe player to disconnect. Must be a valid PlayerRef.
tokenOptional byte array. If provided, it will be used as the disconnection token.

This method can only be called from the server. If called from a client, an error message will be logged.

◆ EnsureRunnerSceneIsActive()

bool EnsureRunnerSceneIsActive ( out Scene  previousActiveScene)

Ensures the scene of this runner is active and returns the previous active scene

Parameters
previousActiveScenePrevious active scene
Returns
True if the scene was changed, false otherwise

◆ Exists() [1/2]

bool Exists ( NetworkId  id)

Returns if the Fusion.Simulation contains a NetworkObject with given id in the current State.

◆ Exists() [2/2]

bool Exists ( NetworkObject  obj)

Returns if the Fusion.Simulation contains a reference to a NetworkObject in the current State.

◆ FindObject()

NetworkObject FindObject ( NetworkId  networkId)

Get the NetworkObject instance for this NetworkRunner from a NetworkId.

Parameters
networkIdNetworkID to look forward
Returns
null if object cannot be found.

◆ GetAllBehaviours()

SimulationBehaviour [] GetAllBehaviours ( Type  type)

Returns an array of all SimulationBehaviour instances registered with this NetworkRunner.

Parameters
typeThe type of the behaviours to be returned.
Returns
An array of SimulationBehaviour instances of the specified type.

◆ GetAllBehaviours< T >() [1/2]

List<T> GetAllBehaviours< T > ( )

Get a list with all behaviours of the desired type that are registered on the NetworkRunner.

Template Parameters
TSimulationBehaviour type
Returns
The result list
Type Constraints
T :SimulationBehaviour 

◆ GetAllBehaviours< T >() [2/2]

void GetAllBehaviours< T > ( List< T >  result)

Add on the list all behaviours of the desired type that are registered on the NetworkRunner. Note: The list will not be cleared before adding the results.

Parameters
resultThe list to add the behaviours
Template Parameters
TSimulationBehaviour type
Type Constraints
T :SimulationBehaviour 

◆ GetAllNetworkObjects() [1/2]

List<NetworkObject> GetAllNetworkObjects ( )

Retrieves a list of all network objects in the simulation.

Returns
A list of NetworkObject instances.

◆ GetAllNetworkObjects() [2/2]

void GetAllNetworkObjects ( List< NetworkObject result)

Populate a list with all network objects in the simulation.

Parameters
resultThe list to which the network objects will be added.

◆ GetAreaOfInterestGizmoData()

void GetAreaOfInterestGizmoData ( List<(Vector3 center, Vector3 size, int playerCount, int objectCount)>  result)

Populates the provided list with data about the current Area of Interest (AOI) cells. Each element in the list represents one AOI cell.

Parameters
resultThe list to be populated with AOI cell data. Each tuple in the list contains the center of the AOI cell, its size, the count of players in the cell, and the count of objects in the cell.

◆ GetAvailableRegions()

static Task<List<RegionInfo> > GetAvailableRegions ( string  appId = default,
CancellationToken  cancellationToken = default 
)
static

Starts an operation to retrieves the list of available regions.

Parameters
appIdOptional App ID. If not provided, the method will use the global App ID from the PhotonAppSettings.
cancellationTokenOptional CancellationToken parameter that can be used to cancel the operation.
Returns
Returns a list with information about all the available regions.

◆ GetInputForPlayer< T >()

T? GetInputForPlayer< T > ( PlayerRef  player)

Returns the NetworkInput data from player, converted to the indicated INetworkInput.

Type Constraints
T :unmanaged 
T :INetworkInput 

◆ GetInstancesEnumerator()

static List<NetworkRunner>.Enumerator GetInstancesEnumerator ( )
static

Get enumerator for the collection of all NetworkRunners. Allows to enumerate alloc-free.

◆ GetInterfaceListHead()

SimulationBehaviourListScope GetInterfaceListHead ( Type  type,
int  index,
out SimulationBehaviour  head 
)

Get the interface list head.

Parameters
typeThe interface type
indexThe desired index on the list of behaviourList
headThe head reference
Returns
A disposable SimulationBehaviourListScope to be used on an using scope

◆ GetInterfaceListNext()

SimulationBehaviour GetInterfaceListNext ( SimulationBehaviour  behaviour)

Get the next behaviour

Parameters
behaviourThe reference behaviour to get the next one
Returns
Gives the next behaviour

◆ GetInterfaceListPrev()

SimulationBehaviour GetInterfaceListPrev ( SimulationBehaviour  behaviour)

Get the previous behaviour

Parameters
behaviourThe reference behaviour to get the previous one
Returns
Gives the previous behaviour

◆ GetInterfaceListsCount()

int GetInterfaceListsCount ( Type  type)

Get the number of interfaces of the desired type that are registered on the behaviour updater.

Parameters
typeThe interface type
Returns
The number of interfaces

◆ GetMemorySnapshot()

void GetMemorySnapshot ( MemoryStatisticsSnapshot.TargetAllocator  targetAllocator,
ref MemoryStatisticsSnapshot  snapshot 
)

Gets a memory snapshot of the simulation.

Parameters
targetAllocatorThe target allocator for the memory statistics. Must be a valid value from the MemoryStatisticsSnapshot.TargetAllocator enum.
snapshotA reference to the MemoryStatisticsSnapshot struct that will store the memory snapshot.

◆ GetObjectsInAreaOfInterestForPlayer()

List<NetworkId> GetObjectsInAreaOfInterestForPlayer ( PlayerRef  player)

Retrieves a list of network object IDs that are in the area of interest for the specified player. Server only.

Parameters
playerThe player for whom the area of interest is being queried.
Returns
A list of network object IDs in the area of interest for the player.

◆ GetPhysicsScene()

PhysicsScene GetPhysicsScene ( )

Get the 3D Physics scene being used by this Runner.

◆ GetPhysicsScene2D()

PhysicsScene2D GetPhysicsScene2D ( )

Get the 2D Physics scene being used by this Runner.

◆ GetPlayerActorId()

int? GetPlayerActorId ( PlayerRef  player)

Gets Player's Actor Number (ID).

If used in Shared Mode, every client can get this information. If used in Client Server Mode, only the Server is able to get this information.

Parameters
playerPlayerRef to get the Actor Number (ID)
Returns
Actor Number associated with the PlayerRef, otherwise null.

◆ GetPlayerConnectionToken()

byte [] GetPlayerConnectionToken ( PlayerRef  player = default)

Returns a copy of the Connection Token used by a Player when connecting to this Server. Only available on Server. It will return null if running on a Client or the Connection token is missing

Parameters
playerPlayerRef to check for a Connection Token
Returns
Copy of the Connection Token

◆ GetPlayerConnectionType()

ConnectionType GetPlayerConnectionType ( PlayerRef  player)

Return the ConnectionType with a Remote PlayerRef. Valid only when invoked from a Server (NetworkRunner.IsServer)

Parameters
playerRemote Player to check the ConnectionType
Returns
ConnectionType with a PlayerRef

◆ GetPlayerObject()

NetworkObject GetPlayerObject ( PlayerRef  player)

Gets the network object associated with a specific player

Parameters
playerPlayerRef to get the network object
Returns
Network object if one is associated with the player

◆ GetPlayerRtt()

double GetPlayerRtt ( PlayerRef  playerRef)

Returns the player round trip time (ping) in seconds

Parameters
playerRefThe player you want the round trip time for

◆ GetPlayerUserId()

string GetPlayerUserId ( PlayerRef  player = default)

Gets Player's UserID.

If used in Shared Mode, every client can get this information. If used in Client Server Mode, only the Server is able to get this information.

Parameters
playerPlayerRef to get the UserID. If no PlayerRef is passed, the UserID of the local client is returned instead.
Returns
UserID if valid player found, otherwise null.

◆ GetRawInputForPlayer()

NetworkInput? GetRawInputForPlayer ( PlayerRef  player)

Returns the unconverted unsafe NetworkInput for the indicated player.

◆ GetResumeSnapshotNetworkObjects()

IEnumerable<NetworkObject> GetResumeSnapshotNetworkObjects ( )

Iterate over the old NetworkObjects from the Resume Snapshot

Returns
Iterable list of NetworkObject

◆ GetResumeSnapshotNetworkSceneObjects()

IEnumerable<(NetworkObject, NetworkObjectHeaderPtr)> GetResumeSnapshotNetworkSceneObjects ( )

Iterate over the Scene NetworkObjects from the Resume Snapshot while giving the reference of the old Snapshot data associated with that particular Scene Object

Returns
Iterable list of Scene NetworkObject and Scene Object Header

◆ GetRpcTargetStatus()

RpcTargetStatus GetRpcTargetStatus ( PlayerRef  target)

Return the RpcTargetStatus for a specific player.

◆ GetRunnerForGameObject()

static NetworkRunner GetRunnerForGameObject ( GameObject  gameObject)
static

Get the NetworkRunner a GameObject instance belongs to.

Parameters
gameObjectGameObject to check for a NetworkRunner
Returns
NetworkRunner reference, or null if not found

◆ GetRunnerForScene()

static NetworkRunner GetRunnerForScene ( Scene  scene)
static

Get the NetworkRunner from a specific Scene

Parameters
sceneScene to check for a NetworkRunner
Returns
NetworkRunner reference, or null if not found

◆ GetSingleton< T >()

T GetSingleton< T > ( )

Ensures that a specific SimulationBehaviour component exists on this NetworkRunner gameobject.

Type Constraints
T :SimulationBehaviour 

◆ HasSingleton< T >()

bool HasSingleton< T > ( )

Returns if a given SimulationBehaviour is present in this NetworkRunner gameobject.

Returns
Returns true if the SimulationBehaviour was found
Type Constraints
T :SimulationBehaviour 

◆ InstantiateInRunnerScene() [1/2]

GameObject InstantiateInRunnerScene ( GameObject  original)

Instantiates an object in the scene of this runner

◆ InstantiateInRunnerScene() [2/2]

GameObject InstantiateInRunnerScene ( GameObject  original,
Vector3  position,
Quaternion  rotation 
)

Instantiates an object in the scene of this runner

◆ InstantiateInRunnerScene< T >() [1/2]

T InstantiateInRunnerScene< T > ( original)

Instantiates an object in the scene of this runner

Type Constraints
T :Component 

◆ InstantiateInRunnerScene< T >() [2/2]

T InstantiateInRunnerScene< T > ( original,
Vector3  position,
Quaternion  rotation 
)

Instantiates an object in the scene of this runner

Type Constraints
T :Component 

◆ InvokeSceneLoadDone()

void InvokeSceneLoadDone ( in SceneLoadDoneArgs  info)

◆ InvokeSceneLoadStart()

void InvokeSceneLoadStart ( SceneRef  sceneRef)

◆ IsInterestedIn()

bool? IsInterestedIn ( NetworkObject  obj,
PlayerRef  player 
)

Test if a player has Interest in a NetworkObject.

Returns
Returns null if interest cannot be determined (clients without State Authority are not aware of other client's Object Interest)

◆ IsPlayerValid()

bool IsPlayerValid ( PlayerRef  player)

Checks if the provided player is valid in the current simulation.

Parameters
playerThe player reference to be validated.
Returns
Returns true if the player is valid, false otherwise.

◆ JoinSessionLobby()

async Task<StartGameResult> JoinSessionLobby ( SessionLobby  sessionLobby,
string  lobbyID = null,
AuthenticationValues  authentication = null,
FusionAppSettings  customAppSettings = null,
bool?  useDefaultCloudPorts = false,
CancellationToken  cancellationToken = default,
bool  useCachedRegions = true 
)

Join the Peer to a specific Lobby, either a prebuild or a custom one.

More about matchmaking: https://doc.photonengine.com/en-us/fusion/current/manual/matchmaking

Parameters
sessionLobbyLobby Type to Join
lobbyIDLobby ID
authenticationAuthentication Values used to authenticate this peer
customAppSettingsCustom Photon Application Settings
useDefaultCloudPortsSignal if the LoadBalancingClient should use the Default or Alternative Ports
cancellationTokenOptional Cancellation Token
useCachedRegionsSignal if the cached regions ping should be used to speed up connection
Returns
Async Task to Join a Session Lobby. Can be used to wait for the process to be finished.

◆ LoadScene() [1/3]

NetworkSceneAsyncOp LoadScene ( SceneRef  sceneRef,
LoadSceneMode  loadSceneMode = LoadSceneMode.Single,
LocalPhysicsMode  localPhysicsMode = LocalPhysicsMode.None,
bool  setActiveOnLoad = DefaultSetActiveOnLoad 
)

Loads a scene

Parameters
sceneRefReference to the scene to load
loadSceneModeScene load mode
localPhysicsModeScene physics mode
setActiveOnLoadShould the scene be set as active when loaded
Returns
Scene Load operation

◆ LoadScene() [2/3]

NetworkSceneAsyncOp LoadScene ( string  sceneName,
LoadSceneMode  loadSceneMode = LoadSceneMode.Single,
LocalPhysicsMode  localPhysicsMode = LocalPhysicsMode.None,
bool  setActiveOnLoad = DefaultSetActiveOnLoad 
)

Loads a scene

Parameters
sceneNameName of the scene to load
loadSceneModeScene load mode
localPhysicsModeScene physics mode
setActiveOnLoadShould the scene be set as active when loaded
Returns
Scene Load operation

◆ LoadScene() [3/3]

NetworkSceneAsyncOp LoadScene ( string  sceneName,
LoadSceneParameters  parameters,
bool  setActiveOnLoad = DefaultSetActiveOnLoad 
)

Loads a scene

Parameters
sceneNameName of the scene to load
parametersParameters to use when loading the scene
setActiveOnLoadShould the scene be set as active when loaded
Returns
Scene Load operation

◆ MakeDontDestroyOnLoad()

void MakeDontDestroyOnLoad ( GameObject  obj)

Mark an object as DontDestroyOnLoad.

Parameters
objObject to mark

◆ MoveGameObjectToSameScene()

bool MoveGameObjectToSameScene ( GameObject  gameObj,
GameObject  other 
)

Moves a GameObject to the same scene as another GameObject

Parameters
gameObjGame Object to move
otherGame Object to move to the same scene as
Returns
True if the object was moved, false otherwise

◆ MoveGameObjectToScene()

bool MoveGameObjectToScene ( GameObject  gameObj,
SceneRef  sceneRef 
)

Moves a GameObject to a specific scene

Parameters
gameObjGame Object to move
sceneRefScene to move the object to
Returns
True if the object was moved, false otherwise

◆ MoveToRunnerScene()

void MoveToRunnerScene ( GameObject  instance,
SceneRef targetSceneRef = null 
)

Moves an object to the scene of this runner

Parameters
instanceObject to move
targetSceneRefTarget scene to move the object to

◆ MoveToRunnerScene< T >()

void MoveToRunnerScene< T > ( component)

Moves an object to the scene of this runner

Template Parameters
T
Parameters
componentComponent of object to move
Type Constraints
T :Component 

◆ ObjectDelegate()

delegate void ObjectDelegate ( NetworkRunner  runner,
NetworkObject  obj 
)

Delegate type for object callback

◆ OnBeforeSpawned()

delegate void OnBeforeSpawned ( NetworkRunner  runner,
NetworkObject  obj 
)

Delegate type for on before spawned callback

◆ PushHostMigrationSnapshot()

async Task<bool> PushHostMigrationSnapshot ( )

Compute and send a Host Migration Snapshot to the Photon Cloud

Returns
Task with the result of the operation. True if it was successful, false otherwise.

◆ RegisterSceneObjects()

int RegisterSceneObjects ( SceneRef  scene,
NetworkObject[]  objects,
NetworkSceneLoadId  loadId = default 
)

Registers scene objects to the network.

Parameters
sceneThe scene reference. Must be valid.
objectsArray of NetworkObject instances to be registered. Must not be null.
loadIdOptional NetworkSceneLoadId. Default value is used if not provided.
Returns
The number of objects registered.
Exceptions
ArgumentExceptionThrown when the provided scene is not valid.
ArgumentNullExceptionThrown when the provided objects array is null.

◆ ReleaseStateAuthority()

void ReleaseStateAuthority ( NetworkId  id)

Releases state authority for a given NetworkId on shared mode.

Parameters
idThe NetworkId for which state authority needs to be released.

◆ RemoveCallbacks()

void RemoveCallbacks ( params INetworkRunnerCallbacks[]  callbacks)

Unregister an INetworkRunnerCallbacks instance for callbacks from this NetworkRunner.

Parameters
callbacksCallbacks to unregister

◆ RemoveGlobal()

void RemoveGlobal ( SimulationBehaviour  instance)

Removes a specific SimulationBehaviour from this NetworkObject gameobject, if it exists.

◆ RenderInternal()

void RenderInternal ( )

This method is meant to be called by INetworkRunnerUpdater.

◆ RequestStateAuthority()

void RequestStateAuthority ( NetworkId  id)

Requests state authority for a specified NetworkId on shared mode.

Parameters
idThe NetworkId for which state authority is being requested.

◆ SendReliableDataToPlayer()

void SendReliableDataToPlayer ( PlayerRef  player,
ReliableKey  key,
byte[]  data 
)

Sends a reliable data buffer to a target player.

Parameters
playerThe player who should receive the buffer.
keyThe key associated with the reliable data.
dataThe data buffer to be sent.

◆ SendReliableDataToServer()

void SendReliableDataToServer ( ReliableKey  key,
byte[]  data 
)

Sends a reliable data buffer to the server.

Parameters
keyThe key associated with the reliable data.
dataThe data buffer to be sent.

If the runner is a client, the data is sent to the server (connection index 0) with the player's index. If the runner is a server, the data is sent via the simulation callbacks.

◆ SendRpc() [1/2]

void SendRpc ( SimulationMessage message)

Sends RPC message. Not meant to be used directly, ILWeaver calls this.

Parameters
messageSimulationMessage to send

◆ SendRpc() [2/2]

void SendRpc ( SimulationMessage message,
out RpcSendResult  info 
)

Sends RPC message. Not meant to be used directly, ILWeaver calls this.

Parameters
messageSimulationMessage to send
infoRpcSendResult

◆ SetAreaOfInterestCellSize()

void SetAreaOfInterestCellSize ( int  size)

Set the area of interest cell size

Parameters
sizeSize of the cell
Exceptions
ExceptionCan't change cell size in shared mode

◆ SetAreaOfInterestGrid()

void SetAreaOfInterestGrid ( int  x,
int  y,
int  z 
)

Set the area of interest grid dimensions

Parameters
xX dimension
yY dimension
zZ dimension
Exceptions
ExceptionCan't change grid size in shared mode
ExceptionCall SetAreaOfInterestCellSize first.

◆ SetBehaviourReplicateTo()

void SetBehaviourReplicateTo ( NetworkBehaviour  behaviour,
PlayerRef  player,
bool  replicate 
)

Controls if a specific network behaviours state is replicated to a player or not

Parameters
behaviourThe behaviour to change replication status for
playerThe player to change replication status for
replicatetrue = replicate, false = don't replicate

◆ SetBehaviourReplicateToAll()

void SetBehaviourReplicateToAll ( NetworkBehaviour  behaviour,
bool  replicate 
)

Controls if a specific network behaviours state is replicated to all players or not

Parameters
behaviourThe behaviour to change replication status for
replicatetrue = replicate, false = don't replicate

◆ SetIsSimulated()

bool SetIsSimulated ( NetworkObject  obj,
bool  simulate 
)

Sets the simulation state for this object, if it takes part in the NetworkFixedUpdate, etc.

Parameters
objthe object to change state for
simulatetrue if it should be simulated, false if otherwise
Returns
true if the state of the object changed, false otherwise

◆ SetMasterClient()

void SetMasterClient ( PlayerRef  player)

Promote a player to be the new master client. Only the master client is able to call this method

Parameters
playerThe player to be promoted to master client

◆ SetPlayerAlwaysInterested()

void SetPlayerAlwaysInterested ( PlayerRef  player,
NetworkObject  networkObject,
bool  alwaysInterested 
)

Flags this player as always interested in this object. Means it does not have to be in a players area of interest to be replicated. Only the NetworkObject State Authority can set interest.

Parameters
playerThe player
networkObjectThe object
alwaysInterestedIf he's always interested, or not.

◆ SetPlayerObject()

void SetPlayerObject ( PlayerRef  player,
NetworkObject  networkObject 
)

Sets the network object associated with this player

Parameters
playerPlayerRef to set the network object
networkObjectNetwork object to associate with the player

◆ SetSimulateMultiPeerPhysics()

void SetSimulateMultiPeerPhysics ( bool  value)

Set the value for simulating physics scenes when using multi-peer. Restores the default physics simulation settings if false, overrides the default if true. (2D: SimulationMode2D.Script | 3D: AutoSimulation = false)

Parameters
valueThe value to set. True to simulate physics scenes, false otherwise.

◆ Shutdown()

Task Shutdown ( bool  destroyGameObject = true,
ShutdownReason  shutdownReason = ShutdownReason.Ok,
bool  forceShutdownProcedure = false 
)

Initiates a Simulation.Dispose.

◆ SinglePlayerContinue()

void SinglePlayerContinue ( )

Continues a paused game in single player

◆ SinglePlayerPause() [1/2]

void SinglePlayerPause ( )

Pauses the game in single player

◆ SinglePlayerPause() [2/2]

void SinglePlayerPause ( bool  paused)

Sets the paused state in a single player

◆ Spawn() [1/5]

NetworkObject Spawn ( GameObject  prefab,
Vector3?  position = null,
Quaternion?  rotation = null,
PlayerRef inputAuthority = null,
OnBeforeSpawned  onBeforeSpawned = null,
NetworkSpawnFlags  flags = default 
)

Attempts to network instantiate a NetworkObject using a GameObject. The supplied GameObject must have a NetworkObject component.

Parameters
prefabA GameObject with a NetworkObject
positionSpawn Position
rotationSpawn Rotation
inputAuthorityPlayer Input Authority
onBeforeSpawnedOnBeforeSpawned reference
flagsSpawn flags
Returns
NetworkObject reference, or null if it was not able to spawn the object

◆ Spawn() [2/5]

NetworkObject Spawn ( NetworkObject  prefab,
Vector3?  position = null,
Quaternion?  rotation = null,
PlayerRef inputAuthority = null,
OnBeforeSpawned  onBeforeSpawned = null,
NetworkSpawnFlags  flags = default 
)

Attempts to network instantiate a NetworkObject using a NetworkObject prefab. Note: position and rotation values are only used locally for the instantiation of the object, and are not inherently networked. Use NetworkTransform (or any custom class derived from NetworkTRSP) to replicate the initial transform state.

Parameters
prefabPrefab used to spawn the NetworkObject
positionSpawn Position
rotationSpawn Rotation
inputAuthorityPlayer Input Authority
onBeforeSpawnedOnBeforeSpawned reference
flagsSpawn flags
Returns
NetworkObject reference, or null if it was not able to spawn the object

◆ Spawn() [3/5]

NetworkObject Spawn ( NetworkObjectGuid  prefabGuid,
Vector3?  position = null,
Quaternion?  rotation = null,
PlayerRef inputAuthority = null,
OnBeforeSpawned  onBeforeSpawned = null,
NetworkSpawnFlags  flags = default 
)

Attempts to network instantiate a NetworkObject using a NetworkObjectGuid Note: position and rotation values are only used locally for the instantiation of the object, and are not inherently networked. Use NetworkTransform (or any custom class derived from NetworkTRSP) to replicate the initial transform state.

Parameters
prefabGuidObject Guid used to spawn the NetworkObject
positionSpawn Position
rotationSpawn Rotation
inputAuthorityPlayer Input Authority
onBeforeSpawnedOnBeforeSpawned reference
flagsSpawn flags
Returns
NetworkObject reference, or null if it was not able to spawn the object

◆ Spawn() [4/5]

NetworkObject Spawn ( NetworkPrefabId  typeId,
Vector3?  position = null,
Quaternion?  rotation = null,
PlayerRef inputAuthority = null,
OnBeforeSpawned  onBeforeSpawned = null,
NetworkSpawnFlags  flags = default 
)

Attempts to network instantiate a NetworkObject using a NetworkPrefabId Note: position and rotation values are only used locally for the instantiation of the object, and are not inherently networked. Use NetworkTransform (or any custom class derived from NetworkTRSP) to replicate the initial transform state.

Parameters
typeIdPrefab ID used to spawn the NetworkObject
positionSpawn Position
rotationSpawn Rotation
inputAuthorityPlayer Input Authority
onBeforeSpawnedOnBeforeSpawned reference
flagsSpawn flags
Returns
NetworkObject reference, or null if it was not able to spawn the object

◆ Spawn() [5/5]

NetworkObject Spawn ( NetworkPrefabRef  prefabRef,
Vector3?  position = null,
Quaternion?  rotation = null,
PlayerRef inputAuthority = null,
OnBeforeSpawned  onBeforeSpawned = null,
NetworkSpawnFlags  flags = default 
)

Attempts to network instantiate a NetworkObject using a NetworkPrefabRef. Note: position and rotation values are only used locally for the instantiation of the object, and are not inherently networked. Use NetworkTransform (or any custom class derived from NetworkTRSP) to replicate the initial transform state.

Parameters
prefabRefPrefab Ref used to spawn the NetworkObject
positionSpawn Position
rotationSpawn Rotation
inputAuthorityPlayer Input Authority
onBeforeSpawnedOnBeforeSpawned reference
flagsSpawn flags
Returns
NetworkObject reference, or null if it was not able to spawn the object

◆ Spawn< T >()

T Spawn< T > ( prefab,
Vector3?  position = null,
Quaternion?  rotation = null,
PlayerRef inputAuthority = null,
OnBeforeSpawned  onBeforeSpawned = null,
NetworkSpawnFlags  flags = default 
)

Attempts to network instantiate a NetworkObject using a Component type that is part of a NetworkObject

Template Parameters
TMust be a Type derived from SimulationBehaviour
Parameters
prefabSimulationBehaviour used to spawn the NetworkObject
Returns
T reference, or null if it was not able to spawn the object
Parameters
positionSpawn Position
rotationSpawn Rotation
inputAuthorityPlayer Input Authority
onBeforeSpawnedOnBeforeSpawned reference
flagsSpawn flags
Type Constraints
T :SimulationBehaviour 

◆ SpawnAsync() [1/5]

NetworkSpawnOp SpawnAsync ( GameObject  prefab,
Vector3?  position = null,
Quaternion?  rotation = null,
PlayerRef inputAuthority = null,
OnBeforeSpawned  onBeforeSpawned = null,
NetworkSpawnFlags  flags = default,
NetworkObjectSpawnDelegate  onCompleted = null 
)

Attempts to network instantiate a NetworkObject using a GameObject. The supplied GameObject must have a NetworkObject component.

Parameters
prefabA GameObject with a NetworkObject
positionSpawn Position
rotationSpawn Rotation
inputAuthorityPlayer Input Authority
onBeforeSpawnedOnBeforeSpawned reference
flagsSpawn flags

,

Parameters
onCompletedA callback to fire once the spawn is done.

◆ SpawnAsync() [2/5]

NetworkSpawnOp SpawnAsync ( NetworkObject  prefab,
Vector3?  position = null,
Quaternion?  rotation = null,
PlayerRef inputAuthority = null,
OnBeforeSpawned  onBeforeSpawned = null,
NetworkSpawnFlags  flags = default,
NetworkObjectSpawnDelegate  onCompleted = null 
)

Attempts to network instantiate a NetworkObject using a NetworkObject prefab. Note: position and rotation values are only used locally for the instantiation of the object, and are not inherently networked. Use NetworkTransform (or any custom class derived from NetworkTRSP) to replicate the initial transform state.

Parameters
prefabPrefab used to spawn the NetworkObject
positionSpawn Position
rotationSpawn Rotation
inputAuthorityPlayer Input Authority
onBeforeSpawnedOnBeforeSpawned reference
flagsSpawn flags

,

Parameters
onCompletedA callback to fire once the spawn is done.

◆ SpawnAsync() [3/5]

NetworkSpawnOp SpawnAsync ( NetworkObjectGuid  prefabGuid,
Vector3?  position = null,
Quaternion?  rotation = null,
PlayerRef inputAuthority = null,
OnBeforeSpawned  onBeforeSpawned = null,
NetworkSpawnFlags  flags = default,
NetworkObjectSpawnDelegate  onCompleted = null 
)

Attempts to network instantiate a NetworkObject using a NetworkObjectGuid Note: position and rotation values are only used locally for the instantiation of the object, and are not inherently networked. Use NetworkTransform (or any custom class derived from NetworkTRSP) to replicate the initial transform state.

Parameters
prefabGuidObject Guid used to spawn the NetworkObject
positionSpawn Position
rotationSpawn Rotation
inputAuthorityPlayer Input Authority
onBeforeSpawnedOnBeforeSpawned reference
flagsSpawn flags

,

Parameters
onCompletedA callback to fire once the spawn is done.

◆ SpawnAsync() [4/5]

NetworkSpawnOp SpawnAsync ( NetworkPrefabId  typeId,
Vector3?  position = null,
Quaternion?  rotation = null,
PlayerRef inputAuthority = null,
OnBeforeSpawned  onBeforeSpawned = null,
NetworkSpawnFlags  flags = default,
NetworkObjectSpawnDelegate  onCompleted = null 
)

Attempts to network instantiate a NetworkObject using a NetworkPrefabId Note: position and rotation values are only used locally for the instantiation of the object, and are not inherently networked. Use NetworkTransform (or any custom class derived from NetworkTRSP) to replicate the initial transform state.

Parameters
typeIdPrefab ID used to spawn the NetworkObject
positionSpawn Position
rotationSpawn Rotation
inputAuthorityPlayer Input Authority
onBeforeSpawnedOnBeforeSpawned reference
flagsSpawn flags

,

Parameters
onCompletedA callback to fire once the spawn is done.

◆ SpawnAsync() [5/5]

NetworkSpawnOp SpawnAsync ( NetworkPrefabRef  prefabRef,
Vector3?  position = null,
Quaternion?  rotation = null,
PlayerRef inputAuthority = null,
OnBeforeSpawned  onBeforeSpawned = null,
NetworkSpawnFlags  flags = default,
NetworkObjectSpawnDelegate  onCompleted = null 
)

Attempts to network instantiate a NetworkObject using a NetworkPrefabRef. Note: position and rotation values are only used locally for the instantiation of the object, and are not inherently networked. Use NetworkTransform (or any custom class derived from NetworkTRSP) to replicate the initial transform state.

Parameters
prefabRefPrefab Ref used to spawn the NetworkObject
positionSpawn Position
rotationSpawn Rotation
inputAuthorityPlayer Input Authority
onBeforeSpawnedOnBeforeSpawned reference
flagsSpawn flags

,

Parameters
onCompletedA callback to fire once the spawn is done.

◆ SpawnAsync< T >()

NetworkSpawnOp SpawnAsync< T > ( prefab,
Vector3?  position = null,
Quaternion?  rotation = null,
PlayerRef inputAuthority = null,
OnBeforeSpawned  onBeforeSpawned = null,
NetworkSpawnFlags  flags = default,
NetworkObjectSpawnDelegate  onCompleted = null 
)

Attempts to network instantiate a NetworkObject using a Component type that is part of a NetworkObject

Template Parameters
TMust be a Type derived from SimulationBehaviour
Parameters
prefabSimulationBehaviour used to spawn the NetworkObject
Returns
T reference, or null if it was not able to spawn the object
Parameters
onCompletedA callback to fire once the spawn is done.
positionSpawn Position
rotationSpawn Rotation
inputAuthorityPlayer Input Authority
onBeforeSpawnedOnBeforeSpawned reference
flagsSpawn flags
Type Constraints
T :SimulationBehaviour 

◆ StartGame()

Task<StartGameResult> StartGame ( StartGameArgs  args)

Starts the local Fusion Runner and takes care of all major setup necessary

More about matchmaking: https://doc.photonengine.com/en-us/fusion/current/manual/matchmaking

Parameters
argsCustom arguments used to setup the Fusion Simulation
Returns
Task that can be awaited to chain actions

◆ TryFindBehaviour()

bool TryFindBehaviour ( NetworkBehaviourId  behaviourId,
out NetworkBehaviour  behaviour 
)

Get the NetworkBehaviour instance for this NetworkRunner from a NetworkBehaviourId.

Parameters
behaviourIdNetworkBehaviourId to look forward
behaviourNetworkBehaviour reference, if found
Returns
True if object was found.

◆ TryFindBehaviour< T >()

bool TryFindBehaviour< T > ( NetworkBehaviourId  id,
out T  behaviour 
)

Try to find a NetworkBehaviour with the provided NetworkBehaviourId.

Parameters
idThe NetworkBehaviourId to search for
behaviourThe behaviour found
Template Parameters
TA NetworkBehaviour type
Returns
Returns true if the behaviour was found and it is alive. False otherwise
Type Constraints
T :NetworkBehaviour 

◆ TryFindObject()

bool TryFindObject ( NetworkId  objectId,
out NetworkObject  networkObject 
)

Get the NetworkObject instance for this NetworkRunner from a NetworkId.

Parameters
objectIdObject NetworkID to look forward
networkObjectNetworkObject reference, if found
Returns
True if object was found.

◆ TryGetBehaviourStatistics()

bool TryGetBehaviourStatistics ( Type  behaviourType,
out BehaviourStatisticsSnapshot  behaviourStatisticsSnapshot 
)

Tries to get the statistics snapshot for a specified behaviour type.

Parameters
behaviourTypeThe type of the behaviour for which to get the statistics snapshot.
behaviourStatisticsSnapshotWhen this method returns, contains the statistics snapshot for the specified behaviour type, if found; otherwise, the default value.
Returns
true if the statistics snapshot for the specified behaviour type is found; otherwise, false.

◆ TryGetFusionStatistics()

bool TryGetFusionStatistics ( out FusionStatisticsManager  statisticsManager)

Tries to get the FusionStatisticsManager from the simulation.

Parameters
statisticsManagerThe FusionStatisticsManager returned by the method
Returns
True if the FusionStatisticsManager is successfully retrieved, otherwise false

◆ TryGetInputForPlayer< T >()

bool TryGetInputForPlayer< T > ( PlayerRef  player,
out T  input 
)

Outputs the NetworkInput from player, translated to the indicated INetworkInput.

Type Constraints
T :unmanaged 
T :INetworkInput 

◆ TryGetNetworkedBehaviourFromNetworkedObjectRef< T >()

T TryGetNetworkedBehaviourFromNetworkedObjectRef< T > ( NetworkId  networkId)

Tries to return the first instance of T found on the root of a NetworkObject.

Template Parameters
TThe type of the component to search for
Parameters
networkIdNetworkId of the NetworkObject to search for
Returns
Returns the found component. Null if the NetworkObject cannot be found, or if T cannot be found on the GameObject.
Type Constraints
T :NetworkBehaviour 

◆ TryGetNetworkedBehaviourId()

NetworkBehaviourId TryGetNetworkedBehaviourId ( NetworkBehaviour  behaviour)

Tries to return a NetworkBehaviourId for the NetworkBehaviour provided.

Parameters
behaviourNetworkBehaviour to get the NetworkBehaviourId from
Returns
Returns a NetworkBehaviourId to the provided behaviour. Returns default if the behaviour is not alive or the NetworkObject that has this behaviour is not valid.

◆ TryGetObjectRefFromNetworkedBehaviour()

NetworkId TryGetObjectRefFromNetworkedBehaviour ( NetworkBehaviour  behaviour)

Tries to return the behaviour NetworkId.

Parameters
behaviourNetworkBehaviour to get the NetworkId from
Returns
Returns the NetworkId of the provided behaviour. Returns default if the behaviour is not alive or the NetworkObject that has this behaviour is not valid.

◆ TryGetPhysicsInfo()

bool TryGetPhysicsInfo ( out NetworkPhysicsInfo  info)

Try to get the physics info.

Parameters
infoNetwork physics info
Returns
True if the physics info exists, otherwise false.

◆ TryGetPlayerObject()

bool TryGetPlayerObject ( PlayerRef  player,
out NetworkObject  networkObject 
)

Try to gets the NetworkObject associated with a specific player

Parameters
playerPlayerRef to get the network object
networkObjectNetwork object if one is associated with the player
Returns
Signals if it was able to get a NetworkObject for the player provided

◆ TryGetSceneInfo()

bool TryGetSceneInfo ( out NetworkSceneInfo  sceneInfo)

Tries to get the NetworkSceneInfo of this NetworkRunner.

Parameters
sceneInfoThe result NetworkSceneInfo
Returns
Returns true if it was able to get the scene info

◆ TrySetPhysicsInfo()

bool TrySetPhysicsInfo ( NetworkPhysicsInfo  info)

Try to set the physics info.

Parameters
infoNetwork physics info
Returns
True if the physics info was set, otherwise false.
Exceptions
InvalidOperationExceptionThrown if the runner does not have the scene authority.

◆ TrySpawn() [1/5]

NetworkSpawnStatus TrySpawn ( GameObject  prefab,
out NetworkObject  obj,
Vector3?  position = null,
Quaternion?  rotation = null,
PlayerRef inputAuthority = null,
OnBeforeSpawned  onBeforeSpawned = null,
NetworkSpawnFlags  flags = default 
)

Attempts to network instantiate a NetworkObject using a GameObject. The supplied GameObject must have a NetworkObject component.

Parameters
prefabA GameObject with a NetworkObject
positionSpawn Position
rotationSpawn Rotation
inputAuthorityPlayer Input Authority
onBeforeSpawnedOnBeforeSpawned reference
flagsSpawn flags
objSpawned NetworkObject reference
Returns
NetworkSpawnStatus reference, or null if it was not able to spawn the object

◆ TrySpawn() [2/5]

NetworkSpawnStatus TrySpawn ( NetworkObject  prefab,
out NetworkObject  obj,
Vector3?  position = null,
Quaternion?  rotation = null,
PlayerRef inputAuthority = null,
OnBeforeSpawned  onBeforeSpawned = null,
NetworkSpawnFlags  flags = default 
)

Attempts to network instantiate a NetworkObject using a NetworkObject prefab. Note: position and rotation values are only used locally for the instantiation of the object, and are not inherently networked. Use NetworkTransform (or any custom class derived from NetworkTRSP) to replicate the initial transform state.

Parameters
prefabPrefab used to spawn the NetworkObject
positionSpawn Position
rotationSpawn Rotation
inputAuthorityPlayer Input Authority
onBeforeSpawnedOnBeforeSpawned reference
flagsSpawn flags
objSpawned NetworkObject reference
Returns
NetworkSpawnStatus reference, or null if it was not able to spawn the object

◆ TrySpawn() [3/5]

NetworkSpawnStatus TrySpawn ( NetworkObjectGuid  prefabGuid,
out NetworkObject  obj,
Vector3?  position = null,
Quaternion?  rotation = null,
PlayerRef inputAuthority = null,
OnBeforeSpawned  onBeforeSpawned = null,
NetworkSpawnFlags  flags = default 
)

Attempts to network instantiate a NetworkObject using a NetworkObjectGuid Note: position and rotation values are only used locally for the instantiation of the object, and are not inherently networked. Use NetworkTransform (or any custom class derived from NetworkTRSP) to replicate the initial transform state.

Parameters
prefabGuidObject Guid used to spawn the NetworkObject
positionSpawn Position
rotationSpawn Rotation
inputAuthorityPlayer Input Authority
onBeforeSpawnedOnBeforeSpawned reference
flagsSpawn flags
objSpawned NetworkObject reference
Returns
NetworkSpawnStatus reference, or null if it was not able to spawn the object

◆ TrySpawn() [4/5]

NetworkSpawnStatus TrySpawn ( NetworkPrefabId  typeId,
out NetworkObject  obj,
Vector3?  position = null,
Quaternion?  rotation = null,
PlayerRef inputAuthority = null,
OnBeforeSpawned  onBeforeSpawned = null,
NetworkSpawnFlags  flags = default 
)

Attempts to network instantiate a NetworkObject using a NetworkPrefabId Note: position and rotation values are only used locally for the instantiation of the object, and are not inherently networked. Use NetworkTransform (or any custom class derived from NetworkTRSP) to replicate the initial transform state.

Parameters
typeIdPrefab ID used to spawn the NetworkObject
positionSpawn Position
rotationSpawn Rotation
inputAuthorityPlayer Input Authority
onBeforeSpawnedOnBeforeSpawned reference
flagsSpawn flags
objSpawned NetworkObject reference
Returns
NetworkSpawnStatus reference, or null if it was not able to spawn the object

◆ TrySpawn() [5/5]

NetworkSpawnStatus TrySpawn ( NetworkPrefabRef  prefabRef,
out NetworkObject  obj,
Vector3?  position = null,
Quaternion?  rotation = null,
PlayerRef inputAuthority = null,
OnBeforeSpawned  onBeforeSpawned = null,
NetworkSpawnFlags  flags = default 
)

Attempts to network instantiate a NetworkObject using a NetworkPrefabRef. Note: position and rotation values are only used locally for the instantiation of the object, and are not inherently networked. Use NetworkTransform (or any custom class derived from NetworkTRSP) to replicate the initial transform state.

Parameters
prefabRefPrefab Ref used to spawn the NetworkObject
positionSpawn Position
rotationSpawn Rotation
inputAuthorityPlayer Input Authority
onBeforeSpawnedOnBeforeSpawned reference
flagsSpawn flags
objSpawned NetworkObject reference
Returns
NetworkSpawnStatus reference, or null if it was not able to spawn the object

◆ TrySpawn< T >()

NetworkSpawnStatus TrySpawn< T > ( prefab,
out T  obj,
Vector3?  position = null,
Quaternion?  rotation = null,
PlayerRef inputAuthority = null,
OnBeforeSpawned  onBeforeSpawned = null,
NetworkSpawnFlags  flags = default 
)

Attempts to network instantiate a NetworkObject using a Component type that is part of a NetworkObject

Template Parameters
TMust be a Type derived from SimulationBehaviour
Parameters
prefabSimulationBehaviour used to spawn the NetworkObject
Returns
T reference, or null if it was not able to spawn the object
Parameters
objSpawned NetworkObject reference
positionSpawn Position
rotationSpawn Rotation
inputAuthorityPlayer Input Authority
onBeforeSpawnedOnBeforeSpawned reference
flagsSpawn flags
Type Constraints
T :SimulationBehaviour 

◆ UnloadScene()

NetworkSceneAsyncOp UnloadScene ( string  sceneName)

Unloads a scene

Parameters
sceneNameName of the scene to unload
Returns
Scene Unload operation

◆ UpdateInternal()

void UpdateInternal ( double  dt)

This method is meant to be called by INetworkRunnerUpdater.

Property Documentation

◆ ActivePlayers

IEnumerable<PlayerRef> ActivePlayers
get

Returns the collection of PlayerRef objects for this NetworkRunner's Fusion.Simulation.

◆ AreaOfInterest

ref Simulation.AreaOfInterestState AreaOfInterest
get

The AreaOfInterest state of the Runner. Can be used for read access to interest management data.

◆ AuthenticationValues

AuthenticationValues AuthenticationValues
get

AuthenticationValues used by this Runner to Authenticate the local peer.

◆ BuildType

BuildTypes BuildType
staticget

Get Fusion.Runtime.dll build type.

◆ CanSpawn

bool CanSpawn
get

Signal if the Network Runner can spawn a NetworkObject

◆ Config

Returns the NetworkProjectConfig reference.

◆ CurrentConnectionType

ConnectionType CurrentConnectionType
get

Check the current Connection Type with the Remote Server

◆ DeltaTime

float DeltaTime
get

Returns the fixed tick time interval. Derived from the SimulationRuntimeConfig.TickRate.

◆ GameMode

Current Game Mode active on the Fusion Simulation

◆ Instances

IReadOnlyList<NetworkRunner> Instances
staticget

A list of all NetworkRunners.

◆ IsClient

bool IsClient
get

Returns if this Fusion.Simulation represents a Client connection.

◆ IsCloudReady

bool IsCloudReady
get

Signal if the Local Peer is connected to Photon Cloud and is able to Create/Join Room but also receive Lobby Updates

◆ IsConnectedToServer

bool IsConnectedToServer
get

Returns if this Client is currently connected to a Remote Server

◆ IsFirstTick

bool IsFirstTick
get

If this is the first tick that executes this update or re-simulation

◆ IsForward

bool IsForward
get

If this is not a re-simulation but a new forward tick

◆ IsLastTick

bool IsLastTick
get

If this is the last tick that is being executed this update

◆ IsPlayer

bool IsPlayer
get

Returns true if this runner represents a Client or Host. Dedicated servers have no local player and will return false.

◆ IsResimulation

bool IsResimulation
get

If we are currently executing a client side prediction re-simulation.

◆ IsResume

bool IsResume
get

if this instance is a resume (host migration)

◆ IsRunning

bool IsRunning
get

Returns if this Fusion.Simulation is valid and running.

◆ IsSceneAuthority

bool IsSceneAuthority
get

Is this runner responsible for scene management.

◆ IsSceneManagerBusy

bool? IsSceneManagerBusy
get

Signals if the INetworkSceneManager instance assigned to this NetworkRunner is busy with any scene loading operation.

◆ IsServer

bool IsServer
get

Returns if this Fusion.Simulation represents a Server connection.

◆ IsSharedModeMasterClient

bool IsSharedModeMasterClient
get

Signal if the Local Peer is in a Room and is the Room Master Client

◆ IsShutdown

bool IsShutdown
get

If the runner is shutdown

◆ IsSimulationUpdating

bool IsSimulationUpdating
get

Is the runner updating the simulation.

◆ IsSinglePlayer

bool IsSinglePlayer
get

Returns true if this runner was started as single player (Started as SimulationModes.Host with SimulationConfig.PlayerCount = 1).

◆ IsStarting

bool IsStarting
get

If the runner is pending to start

◆ LagCompensation

HitboxManager LagCompensation
get

Returns the global instance of a lag compensation buffer Fusion.HitboxManager.

◆ LatestServerTick

Tick LatestServerTick
get

Get the latest confirmed tick of the server we are aware of

◆ LobbyInfo

Signal if the local peer is already inside a Lobby

◆ LocalAlpha

float LocalAlpha
get

Get the local time alpha value

◆ LocalPlayer

PlayerRef LocalPlayer
get

Returns a PlayerRef for the local simulation. For a dedicated server PlayerRef.IsRealPlayer will equal false. PlayerRefs are assigned in order from 0 to MaxPlayers-1 and are re-used as players join and leave. The only caveat is that the server player (if one exists), always gets the last index no matter how many clients are connected.

◆ LocalRenderTime

float??? LocalRenderTime
get

The current time (current State.Time + Simulation.DeltaTime) for predicted objects (objects in the local time frame). Use as an equivalent to Unity's Time.time. Time is relative to Tick 0 (which represents Time 0f).

◆ Mode

SimulationModes Mode
get

Returns the SimulationModes flags for The type of network peer the associated Fusion.Simulation represents.

◆ NATType

Exposes the current NAT Type from the local Peer

◆ ObjectProvider

INetworkObjectProvider ObjectProvider
get

Returns the INetworkObjectProvider instance.

◆ Prefabs

NetworkPrefabTable Prefabs
get

Reference to the NetworkPrefabTable.

◆ ProvideInput

bool ProvideInput
getset

Indicates if this NetworkRunner is collecting PlayerRef INetworkInput.

◆ RemoteRenderTime

float RemoteRenderTime
get

The current time (current State.Time + Simulation.DeltaTime) for non-predicted objects (objects in a remote time frame). Use as an equivalent to Unity's Time.time. Time is relative to Tick 0 (which represents Time 0f).

◆ SceneManager

INetworkSceneManager SceneManager
get

Returns the INetworkSceneManager instance.

◆ SessionInfo

Stores information about the current running session

◆ SimulationTime

float SimulationTime
get

The time the current State represents (the most recent FixedUpdateNetwork simulation). Use as an equivalent to Unity's Time.fixedTime. Time is relative to Tick 0 (which represents Time 0f).

◆ SimulationUnityScene

Scene??? SimulationUnityScene
get

The main scene of the NetworkRunner or default if not running.

◆ Stage

SimulationStages Stage
get

Returns the current SimulationStages stage of this Fusion.Simulation.

◆ State

States State
get

The current state of the runner, if it's Starting, Running, Shutdown

◆ Tick

Tick??? Tick
get

The tick associated with the current state of networked objects, or the current simulation tick being processed (when evaluated during FixedUpdateNetwork).

◆ TickRate

int TickRate
get

◆ TicksExecuted

int TicksExecuted
get

Returns how many ticks we executed last update.

◆ Topology

Topologies Topology
get

The current topology used

◆ UserId

string UserId
get

Photon Client UserID

Returns null if Peer is not connected to Photon Cloud

Event Documentation

◆ ObjectAcquired

ObjectDelegate ObjectAcquired

Event for object acquired