Host Migration related code in order to get a copy of the Simulation State. More...
Inherits Behaviour, and Simulation.ICallbacks.
Public Types | |
enum | BuildTypes |
Enumeration of Fusion.Runtime.dll options. More... | |
enum | States |
Initialization stages of Fusion. More... | |
Public Member Functions | |
void | AddCallbacks (params INetworkRunnerCallbacks[] callbacks) |
Register an INetworkRunnerCallbacks instance for callbacks from this NetworkRunner. | |
void | AddGlobal (SimulationBehaviour instance) |
Add and register a SimulationBehaviour to this NetworkRunner. Note: It should NOT be a NetworkBehaviour | |
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. | |
void | Attach (NetworkObject networkObject, PlayerRef? inputAuthority=null, bool allocate=true, bool? masterClientObjectOverride=null) |
Attaches a user-created network object to the network. | |
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. | |
void | ClearPlayerAreaOfInterest (PlayerRef player) |
Clears the area of interest for a player. This can only be called from the server/host. | |
void | Despawn (NetworkObject networkObject) |
Destroys a NetworkObject. | |
void | DestroySingleton< T > () |
Removes a specific SimulationBehaviour from this NetworkRunner gameobject, if it exists. | |
void | Disconnect (PlayerRef player, byte[] token=null) |
Disconnects a player from the server. | |
bool | EnsureRunnerSceneIsActive (out Scene previousActiveScene) |
Ensures the scene of this runner is active and returns the previous active scene. | |
bool | Exists (NetworkId id) |
Returns if the Fusion.Simulation contains a NetworkObject with given id in the current State. | |
bool | Exists (NetworkObject obj) |
Returns if the Fusion.Simulation contains a reference to a NetworkObject in the current State. | |
NetworkObject | FindObject (NetworkId networkId) |
Get the NetworkObject instance for this NetworkRunner from a NetworkId. | |
SimulationBehaviour[] | GetAllBehaviours (Type type) |
Returns an array of all SimulationBehaviour instances registered with this NetworkRunner. | |
List< T > | GetAllBehaviours< T > () |
Get a list with all behaviours of the desired type that are registered on the NetworkRunner. | |
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. | |
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. | |
T? | GetInputForPlayer< T > (PlayerRef player) |
Returns the NetworkInput data from player, converted to the indicated INetworkInput. | |
SimulationBehaviourListScope | GetInterfaceListHead (Type type, int index, out SimulationBehaviour head) |
Get the interface list head. | |
SimulationBehaviour | GetInterfaceListNext (SimulationBehaviour behaviour) |
Get the next behaviour. | |
SimulationBehaviour | GetInterfaceListPrev (SimulationBehaviour behaviour) |
Get the previous behaviour. | |
int | GetInterfaceListsCount (Type type) |
Get the number of interfaces of the desired type that are registered on the behaviour updater. | |
PhysicsScene | GetPhysicsScene () |
Get the 3D Physics scene being used by this Runner. | |
PhysicsScene2D | GetPhysicsScene2D () |
Get the 2D Physics scene being used by this Runner. | |
int? | GetPlayerActorId (PlayerRef player) |
Gets Player's Actor Number (ID). | |
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. | |
ConnectionType | GetPlayerConnectionType (PlayerRef player) |
Return the ConnectionType with a Remote PlayerRef. Valid only when invoked from a Server (NetworkRunner.IsServer) | |
NetworkObject | GetPlayerObject (PlayerRef player) |
Gets the network object associated with a specific player. | |
double | GetPlayerRtt (PlayerRef playerRef) |
Returns the player round trip time (ping) in seconds. | |
string | GetPlayerUserId (PlayerRef player=default) |
Gets Player's UserID. | |
NetworkInput? | GetRawInputForPlayer (PlayerRef player) |
Returns the unconverted unsafe NetworkInput for the indicated player. | |
IEnumerable< NetworkObject > | GetResumeSnapshotNetworkObjects () |
Iterate over the old NetworkObjects from the Resume Snapshot. | |
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. | |
RpcTargetStatus | GetRpcTargetStatus (PlayerRef target) |
Return the RpcTargetStatus for a specific player. | |
SceneRef | GetSceneRef (GameObject gameObj) |
SceneRef | GetSceneRef (string sceneNameOrPath) |
T | GetSingleton< T > () |
Ensures that a specific SimulationBehaviour component exists on this NetworkRunner gameobject. | |
bool | HasAnyActiveConnections () |
bool | HasSingleton< T > () |
Returns if a given SimulationBehaviour is present in this NetworkRunner gameobject. | |
GameObject | InstantiateInRunnerScene (GameObject original) |
Instantiates an object in the scene of this runner. | |
GameObject | InstantiateInRunnerScene (GameObject original, Vector3 position, Quaternion rotation) |
Instantiates an object in the scene of this runner. | |
T | InstantiateInRunnerScene< T > (T original) |
Instantiates an object in the scene of this runner. | |
T | InstantiateInRunnerScene< T > (T original, Vector3 position, Quaternion rotation) |
Instantiates an object in the scene of this runner. | |
void | InvokeSceneLoadDone (in SceneLoadDoneArgs info) |
Invoke INetworkRunnerCallbacks.OnSceneLoadDone(NetworkRunner) on all implementations. | |
void | InvokeSceneLoadStart (SceneRef sceneRef) |
Invoke INetworkRunnerCallbacks.OnSceneLoadStart(NetworkRunner) on all implementations. | |
bool? | IsInterestedIn (NetworkObject obj, PlayerRef player) |
Test if a player has Interest in a NetworkObject. | |
bool | IsPlayerValid (PlayerRef player) |
Checks if the provided player is valid in the current simulation. | |
async Task< StartGameResult > | JoinSessionLobby (SessionLobby sessionLobby, string lobbyID=null, AuthenticationValues authentication=null, FusionAppSettings customAppSettings=null, bool? useDefaultCloudPorts=false, CancellationToken cancellationToken=default, bool useCachedRegions=false) |
Join the Peer to a specific Lobby, either a prebuild or a custom one. | |
NetworkSceneAsyncOp | LoadScene (SceneRef sceneRef, LoadSceneMode loadSceneMode=LoadSceneMode.Single, LocalPhysicsMode localPhysicsMode=LocalPhysicsMode.None, bool setActiveOnLoad=DefaultSetActiveOnLoad) |
Loads a scene. | |
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. | |
NetworkSceneAsyncOp | LoadScene (string sceneName, LoadSceneParameters parameters, bool setActiveOnLoad=DefaultSetActiveOnLoad) |
Loads a scene. | |
void | MakeDontDestroyOnLoad (GameObject obj) |
Mark an object as DontDestroyOnLoad . | |
bool | MoveGameObjectToSameScene (GameObject gameObj, GameObject other) |
Moves a GameObject to the same scene as another GameObject. | |
bool | MoveGameObjectToScene (GameObject gameObj, SceneRef sceneRef) |
Moves a GameObject to a specific scene. | |
void | MoveToRunnerScene (GameObject instance, SceneRef? targetSceneRef=null) |
Moves an object to the scene of this runner. | |
void | MoveToRunnerScene< T > (T component) |
Moves an object to the scene of this runner. | |
delegate void | ObjectDelegate (NetworkRunner runner, NetworkObject obj) |
Delegate type for object callback. | |
delegate void | OnBeforeSpawned (NetworkRunner runner, NetworkObject obj) |
Delegate type for on before spawned callback. | |
async Task< bool > | PushHostMigrationSnapshot () |
Compute and send a Host Migration Snapshot to the Photon Cloud. | |
int | RegisterSceneObjects (SceneRef scene, NetworkObject[] objects, NetworkSceneLoadId loadId=default) |
Registers scene objects to the network. | |
void | RemoveCallbacks (params INetworkRunnerCallbacks[] callbacks) |
Unregister an INetworkRunnerCallbacks instance for callbacks from this NetworkRunner. | |
void | RemoveGlobal (SimulationBehaviour instance) |
Removes a specific SimulationBehaviour from this NetworkObject gameobject, if it exists. | |
void | RenderInternal () |
This method is meant to be called by INetworkRunnerUpdater. | |
void | SendReliableDataToPlayer (PlayerRef player, ReliableKey key, byte[] data) |
Sends a reliable data buffer to a target player. | |
void | SendReliableDataToServer (ReliableKey key, byte[] data) |
Sends a reliable data buffer to the server. | |
void | SendRpc (SimulationMessage *message) |
Sends RPC message. Not meant to be used directly, ILWeaver calls this. | |
void | SendRpc (SimulationMessage *message, out RpcSendResult info) |
Sends RPC message. Not meant to be used directly, ILWeaver calls this. | |
void | SetAreaOfInterestCellSize (int size) |
Set the area of interest cell size. | |
void | SetAreaOfInterestGrid (int x, int y, int z) |
Set the area of interest grid dimensions. | |
void | SetBehaviourReplicateTo (NetworkBehaviour behaviour, PlayerRef player, bool replicate) |
Controls if a specific network behaviours state is replicated to a player or not. | |
void | SetBehaviourReplicateToAll (NetworkBehaviour behaviour, bool replicate) |
Controls if a specific network behaviours state is replicated to all players or not. | |
bool | SetIsSimulated (NetworkObject obj, bool simulate) |
Sets the simulation state for this object, if it takes part in the NetworkFixedUpdate, etc. | |
void | SetMasterClient (PlayerRef player) |
Promote a player to be the new master client. Only the master client is able to call this method. | |
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. | |
void | SetPlayerObject (PlayerRef player, NetworkObject networkObject) |
Sets the network object associated with this player. | |
Task | Shutdown (bool destroyGameObject=true, ShutdownReason shutdownReason=ShutdownReason.Ok, bool forceShutdownProcedure=false) |
Initiates a Simulation.Dispose. | |
void | SinglePlayerContinue () |
Continues a paused game in single player. | |
void | SinglePlayerPause () |
Pauses the game in single player. | |
void | SinglePlayerPause (bool paused) |
Sets the paused state in a single player. | |
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. | |
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. | |
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. | |
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. | |
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. | |
T | 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 | |
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. | |
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. | |
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. | |
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. | |
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. | |
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 | |
Task< StartGameResult > | StartGame (StartGameArgs args) |
Starts the local Fusion Runner and takes care of all major setup necessary. | |
bool | TryFindBehaviour (NetworkBehaviourId behaviourId, out NetworkBehaviour behaviour) |
Get the NetworkBehaviour instance for this NetworkRunner from a NetworkBehaviourId. | |
bool | TryFindBehaviour< T > (NetworkBehaviourId id, out T behaviour) |
Try to find a NetworkBehaviour with the provided NetworkBehaviourId. | |
bool | TryFindObject (NetworkId objectId, out NetworkObject networkObject) |
Get the NetworkObject instance for this NetworkRunner from a NetworkId. | |
bool | TryGetBehaviourStats (List<(Type, BehaviourStats)> result) |
Populate the provided list with all registered behaviours and their BehaviourStats. | |
bool | TryGetInputForPlayer< T > (PlayerRef player, out T input) |
Outputs the NetworkInput from player, translated to the indicated INetworkInput. | |
T | TryGetNetworkedBehaviourFromNetworkedObjectRef< T > (NetworkId networkId) |
Tries to return the first instance of T found on the root of a NetworkObject. | |
NetworkBehaviourId | TryGetNetworkedBehaviourId (NetworkBehaviour behaviour) |
Tries to return a NetworkBehaviourId for the NetworkBehaviour provided. | |
NetworkId | TryGetObjectRefFromNetworkedBehaviour (NetworkBehaviour behaviour) |
Tries to return the behaviour NetworkId. | |
bool | TryGetObjectStats (NetworkId id, out NetworkObjectStats stats) |
Try to get NetworkObjectStats buffer for a NetworkObject from this NetworkRunner. | |
bool | TryGetPhysicsInfo (out NetworkPhysicsInfo info) |
Try to get the physics info. | |
bool | TryGetPlayerObject (PlayerRef player, out NetworkObject networkObject) |
Try to gets the NetworkObject associated with a specific player. | |
bool | TryGetPlayerStats (PlayerRef player, out SimulationConnectionStats stats) |
Try to get SimulationConnectionStats buffer for a player reference from this NetworkRunner. | |
bool | TryGetSceneInfo (out NetworkSceneInfo sceneInfo) |
Tries to get the NetworkSceneInfo of this NetworkRunner. | |
bool | TryGetSimulationStats (out SimulationStats stats) |
Try to get SimulationStats buffer from this NetworkRunner. | |
bool | TrySetPhysicsInfo (NetworkPhysicsInfo info) |
Try to set the physics info. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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 | |
NetworkSceneAsyncOp | UnloadScene (SceneRef sceneRef) |
NetworkSceneAsyncOp | UnloadScene (string sceneName) |
Unloads a scene. | |
void | UpdateInternal (double dt) |
This method is meant to be called by INetworkRunnerUpdater. | |
Public Member Functions inherited from Behaviour | |
T | AddBehaviour< T > () |
Wrapper for Unity's GameObject.AddComponent() | |
T | GetBehaviour< T > () |
Wrapper for Unity's GameObject.GetComponentInChildren() | |
bool | TryGetBehaviour< T > (out T behaviour) |
Wrapper for Unity's GameObject.TryGetComponent() | |
Static Public Member Functions | |
static List< NetworkRunner >.Enumerator | GetInstancesEnumerator () |
Get enumerator for the collection of all NetworkRunners. Allows to enumerate alloc-free. | |
static NetworkRunner | GetRunnerForGameObject (GameObject gameObject) |
Get the NetworkRunner a GameObject instance belongs to. | |
static NetworkRunner | GetRunnerForScene (Scene scene) |
Get the NetworkRunner from a specific Scene. | |
Static Public Member Functions inherited from Behaviour | |
static void | DestroyBehaviour (Behaviour behaviour) |
Wrapper for Unity's GameObject.Destroy() | |
Properties | |
IEnumerable< PlayerRef > | ActivePlayers [get] |
Returns the collection of PlayerRef objects for this NetworkRunner's Fusion.Simulation. | |
AuthenticationValues | AuthenticationValues [get] |
AuthenticationValues used by this Runner to Authenticate the local peer. | |
static BuildTypes | BuildType [get] |
Get Fusion.Runtime.dll build type. | |
bool | CanSpawn [get] |
Signal if the Network Runner can spawn a NetworkObject | |
NetworkProjectConfig | Config [get] |
Returns the NetworkProjectConfig reference. | |
ConnectionType | CurrentConnectionType [get] |
Check the current Connection Type with the Remote Server. | |
float | DeltaTime [get] |
Returns the fixed tick time interval. Derived from the SimulationRuntimeConfig.TickRate. | |
GameMode | GameMode [get] |
Current Game Mode active on the Fusion Simulation. | |
static IReadOnlyList< NetworkRunner > | Instances [get] |
A list of all NetworkRunners. | |
bool | IsClient [get] |
Returns if this Fusion.Simulation represents a Client connection. | |
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. | |
bool | IsConnectedToServer [get] |
Returns if this Client is currently connected to a Remote Server. | |
bool | IsFirstTick [get] |
If this is the first tick that executes this update or re-simulation. | |
bool | IsForward [get] |
If this is not a re-simulation but a new forward tick. | |
bool | IsLastTick [get] |
If this is the last tick that is being executed this update. | |
bool | IsPlayer [get] |
Returns true if this runner represents a Client or Host. Dedicated servers have no local player and will return false. | |
bool | IsResimulation [get] |
If we are currently executing a client side prediction re-simulation. | |
bool | IsResume [get] |
if this instance is a resume (host migration) | |
bool | IsRunning [get] |
Returns if this Fusion.Simulation is valid and running. | |
bool | IsSceneAuthority [get] |
Is this runner responsible for scene management. | |
bool | IsSceneManagerBusy [get] |
Signals if the INetworkSceneManager instance assigned to this NetworkRunner is busy with any scene loading operation. | |
bool | IsServer [get] |
Returns if this Fusion.Simulation represents a Server connection. | |
bool | IsSharedModeMasterClient [get] |
Signal if the Local Peer is in a Room and is the Room Master Client. | |
bool | IsShutdown [get] |
If the runner is shutdown. | |
bool | IsSinglePlayer [get] |
Returns true if this runner was started as single player (Started as SimulationModes.Host with SimulationConfig.PlayerCount = 1). | |
bool | IsStarting [get] |
If the runner is pending to start. | |
HitboxManager | LagCompensation [get] |
Returns the global instance of a lag compensation buffer Fusion.HitboxManager. | |
Tick | LatestServerTick [get] |
Get the latest confirmed tick of the server we are aware of. | |
LobbyInfo | LobbyInfo = new LobbyInfo() [get] |
Signal if the local peer is already inside a Lobby. | |
float | LocalAlpha [get] |
Get the local time alpha value. | |
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. | |
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). | |
SimulationModes | Mode [get] |
Returns the SimulationModes flags for The type of network peer the associated Fusion.Simulation represents. | |
NATType | NATType [get] |
Exposes the current NAT Type from the local Peer. | |
INetworkObjectProvider | ObjectProvider [get] |
Returns the INetworkObjectProvider instance. | |
NetworkPrefabTable | Prefabs [get] |
Reference to the NetworkPrefabTable. | |
bool | ProvideInput [get, set] |
Indicates if this NetworkRunner is collecting PlayerRef INetworkInput. | |
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). | |
INetworkSceneManager | SceneManager [get] |
Returns the INetworkSceneManager instance. | |
SessionInfo | SessionInfo = new SessionInfo() [get] |
Stores information about the current running session. | |
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). | |
Scene | SimulationUnityScene [get] |
The main scene of the NetworkRunner or default if not running. | |
SimulationStages | Stage [get] |
Returns the current SimulationStages stage of this Fusion.Simulation. | |
States | State [get] |
The current state of the runner, if it's Starting, Running, Shutdown. | |
Tick | Tick [get] |
The tick associated with the current state of networked objects, or the current simulation tick being processed (when evaluated during FixedUpdateNetwork). | |
int | TickRate [get] |
int | TicksExecuted [get] |
Returns how many ticks we executed last update. | |
Topologies | Topology [get] |
The current topology used. | |
string | UserId [get] |
Photon Client UserID. | |
Events | |
ObjectDelegate | ObjectAcquired |
Event for object acquired. | |
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.
enum BuildTypes |
enum States |
Initialization stages of Fusion.
Enumerator | |
---|---|
Starting | Runner is about to start. |
Running | Runner is running. |
Shutdown | Runner is shutdown. |
void AddCallbacks | ( | params INetworkRunnerCallbacks[] | callbacks | ) |
Register an INetworkRunnerCallbacks instance for callbacks from this NetworkRunner.
callbacks | Callbacks to register |
void Attach | ( | NetworkObject | networkObject, |
PlayerRef? | inputAuthority = null , |
||
bool | allocate = true , |
||
bool? | masterClientObjectOverride = null |
||
) |
Attaches a user-created network object to the network.
networkObject | The network object to attach. Must not be null and must have a valid NetworkTypeId. |
inputAuthority | Optional PlayerRef. If assigned, it will be the default input authority for this object. |
allocate | Optional boolean. If true, the object will be allocated in memory and attached to the scene object. Default is true. |
masterClientObjectOverride | Optional boolean. If provided, it will override the master client object setting. Default is null. |
ArgumentNullException | Thrown when the provided network object is null. |
ArgumentException | Thrown when the provided network object has an invalid NetworkTypeId. |
void Despawn | ( | NetworkObject | networkObject | ) |
Destroys a NetworkObject.
networkObject | The 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.
InvalidOperationException | Thrown when the NetworkObject does not belong to this runner. |
void DestroySingleton< T > | ( | ) |
Removes a specific SimulationBehaviour from this NetworkRunner gameobject, if it exists.
T | : | SimulationBehaviour |
void Disconnect | ( | PlayerRef | player, |
byte[] | token = null |
||
) |
Disconnects a player from the server.
player | The player to disconnect. Must be a valid PlayerRef. |
token | Optional 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.
bool EnsureRunnerSceneIsActive | ( | out Scene | previousActiveScene | ) |
Ensures the scene of this runner is active and returns the previous active scene.
previousActiveScene | Previous active scene |
NetworkObject FindObject | ( | NetworkId | networkId | ) |
Get the NetworkObject instance for this NetworkRunner from a NetworkId.
networkId | NetworkID to look forward |
SimulationBehaviour[] GetAllBehaviours | ( | Type | type | ) |
Returns an array of all SimulationBehaviour instances registered with this NetworkRunner.
type | The type of the behaviours to be returned. |
List< T > GetAllBehaviours< T > | ( | ) |
Get a list with all behaviours of the desired type that are registered on the NetworkRunner.
T | SimulationBehaviour type |
T | : | SimulationBehaviour |
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.
result | The list to add the behaviours |
T | SimulationBehaviour type |
T | : | SimulationBehaviour |
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.
result | The 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. |
T? GetInputForPlayer< T > | ( | PlayerRef | player | ) |
Returns the NetworkInput data from player, converted to the indicated INetworkInput.
T | : | unmanaged | |
T | : | INetworkInput |
SimulationBehaviourListScope GetInterfaceListHead | ( | Type | type, |
int | index, | ||
out SimulationBehaviour | head | ||
) |
Get the interface list head.
type | The interface type |
index | The desired index on the list of behaviourList |
head | The head reference |
using
scopeSimulationBehaviour GetInterfaceListNext | ( | SimulationBehaviour | behaviour | ) |
Get the next behaviour.
behaviour | The reference behaviour to get the next one |
SimulationBehaviour GetInterfaceListPrev | ( | SimulationBehaviour | behaviour | ) |
Get the previous behaviour.
behaviour | The reference behaviour to get the previous one |
int GetInterfaceListsCount | ( | Type | type | ) |
Get the number of interfaces of the desired type that are registered on the behaviour updater.
type | The interface type |
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.
player | PlayerRef to get the Actor Number (ID) |
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.
player | PlayerRef to check for a Connection Token |
ConnectionType GetPlayerConnectionType | ( | PlayerRef | player | ) |
Return the ConnectionType with a Remote PlayerRef. Valid only when invoked from a Server (NetworkRunner.IsServer)
player | Remote Player to check the ConnectionType |
NetworkObject GetPlayerObject | ( | PlayerRef | player | ) |
Gets the network object associated with a specific player.
player | PlayerRef to get the network object |
double GetPlayerRtt | ( | PlayerRef | playerRef | ) |
Returns the player round trip time (ping) in seconds.
playerRef | The player you want the round trip time for |
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.
player | PlayerRef to get the UserID. If no PlayerRef is passed, the UserID of the local client is returned instead. |
IEnumerable< NetworkObject > GetResumeSnapshotNetworkObjects | ( | ) |
Iterate over the old NetworkObjects from the Resume Snapshot.
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.
|
static |
Get the NetworkRunner a GameObject instance belongs to.
gameObject | GameObject to check for a NetworkRunner |
|
static |
Get the NetworkRunner from a specific Scene.
scene | Scene to check for a NetworkRunner |
T GetSingleton< T > | ( | ) |
Ensures that a specific SimulationBehaviour component exists on this NetworkRunner gameobject.
T | : | SimulationBehaviour |
bool HasSingleton< T > | ( | ) |
Returns if a given SimulationBehaviour is present in this NetworkRunner gameobject.
T | : | SimulationBehaviour |
T InstantiateInRunnerScene< T > | ( | T | original | ) |
Instantiates an object in the scene of this runner.
T | : | Component |
T InstantiateInRunnerScene< T > | ( | T | original, |
Vector3 | position, | ||
Quaternion | rotation | ||
) |
Instantiates an object in the scene of this runner.
T | : | Component |
bool? IsInterestedIn | ( | NetworkObject | obj, |
PlayerRef | player | ||
) |
Test if a player has Interest in a NetworkObject.
bool IsPlayerValid | ( | PlayerRef | player | ) |
Checks if the provided player is valid in the current simulation.
player | The player reference to be validated. |
async Task< StartGameResult > JoinSessionLobby | ( | SessionLobby | sessionLobby, |
string | lobbyID = null , |
||
AuthenticationValues | authentication = null , |
||
FusionAppSettings | customAppSettings = null , |
||
bool? | useDefaultCloudPorts = false , |
||
CancellationToken | cancellationToken = default , |
||
bool | useCachedRegions = false |
||
) |
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
sessionLobby | Lobby Type to Join |
lobbyID | Lobby ID |
authentication | Authentication Values used to authenticate this peer |
customAppSettings | Custom Photon Application Settings |
useDefaultCloudPorts | Signal if the LoadBalancingClient should use the Default or Alternative Ports |
cancellationToken | Optional Cancellation Token |
useCachedRegions | Signal if the cached regions ping should be used to speed up connection |
NetworkSceneAsyncOp LoadScene | ( | SceneRef | sceneRef, |
LoadSceneMode | loadSceneMode = LoadSceneMode::Single , |
||
LocalPhysicsMode | localPhysicsMode = LocalPhysicsMode::None , |
||
bool | setActiveOnLoad = DefaultSetActiveOnLoad |
||
) |
Loads a scene.
sceneRef | Reference to the scene to load |
loadSceneMode | Scene load mode |
localPhysicsMode | Scene physics mode |
setActiveOnLoad | Should the scene be set as active when loaded |
NetworkSceneAsyncOp LoadScene | ( | string | sceneName, |
LoadSceneMode | loadSceneMode = LoadSceneMode::Single , |
||
LocalPhysicsMode | localPhysicsMode = LocalPhysicsMode::None , |
||
bool | setActiveOnLoad = DefaultSetActiveOnLoad |
||
) |
Loads a scene.
sceneName | Name of the scene to load |
loadSceneMode | Scene load mode |
localPhysicsMode | Scene physics mode |
setActiveOnLoad | Should the scene be set as active when loaded |
NetworkSceneAsyncOp LoadScene | ( | string | sceneName, |
LoadSceneParameters | parameters, | ||
bool | setActiveOnLoad = DefaultSetActiveOnLoad |
||
) |
Loads a scene.
sceneName | Name of the scene to load |
parameters | Parameters to use when loading the scene |
setActiveOnLoad | Should the scene be set as active when loaded |
void MakeDontDestroyOnLoad | ( | GameObject | obj | ) |
Mark an object as DontDestroyOnLoad
.
obj | Object to mark |
bool MoveGameObjectToSameScene | ( | GameObject | gameObj, |
GameObject | other | ||
) |
Moves a GameObject to the same scene as another GameObject.
gameObj | Game Object to move |
other | Game Object to move to the same scene as |
bool MoveGameObjectToScene | ( | GameObject | gameObj, |
SceneRef | sceneRef | ||
) |
Moves a GameObject to a specific scene.
gameObj | Game Object to move |
sceneRef | Scene to move the object to |
void MoveToRunnerScene | ( | GameObject | instance, |
SceneRef? | targetSceneRef = null |
||
) |
Moves an object to the scene of this runner.
instance | Object to move |
targetSceneRef | Target scene to move the object to |
void MoveToRunnerScene< T > | ( | T | component | ) |
Moves an object to the scene of this runner.
T |
component | Component of object to move |
T | : | Component |
async Task< bool > PushHostMigrationSnapshot | ( | ) |
Compute and send a Host Migration Snapshot to the Photon Cloud.
int RegisterSceneObjects | ( | SceneRef | scene, |
NetworkObject[] | objects, | ||
NetworkSceneLoadId | loadId = default |
||
) |
Registers scene objects to the network.
scene | The scene reference. Must be valid. |
objects | Array of NetworkObject instances to be registered. Must not be null. |
loadId | Optional NetworkSceneLoadId. Default value is used if not provided. |
ArgumentException | Thrown when the provided scene is not valid. |
ArgumentNullException | Thrown when the provided objects array is null. |
void RemoveCallbacks | ( | params INetworkRunnerCallbacks[] | callbacks | ) |
Unregister an INetworkRunnerCallbacks instance for callbacks from this NetworkRunner.
callbacks | Callbacks to unregister |
void SendReliableDataToPlayer | ( | PlayerRef | player, |
ReliableKey | key, | ||
byte[] | data | ||
) |
Sends a reliable data buffer to a target player.
player | The player who should receive the buffer. |
key | The key associated with the reliable data. |
data | The data buffer to be sent. |
void SendReliableDataToServer | ( | ReliableKey | key, |
byte[] | data | ||
) |
Sends a reliable data buffer to the server.
key | The key associated with the reliable data. |
data | The 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.
void SendRpc | ( | SimulationMessage * | message | ) |
Sends RPC message. Not meant to be used directly, ILWeaver calls this.
message | SimulationMessage to send |
void SendRpc | ( | SimulationMessage * | message, |
out RpcSendResult | info | ||
) |
Sends RPC message. Not meant to be used directly, ILWeaver calls this.
message | SimulationMessage to send |
info | RpcSendResult |
void SetAreaOfInterestCellSize | ( | int | size | ) |
Set the area of interest cell size.
size | Size of the cell |
Exception | Can't change cell size in shared mode |
void SetAreaOfInterestGrid | ( | int | x, |
int | y, | ||
int | z | ||
) |
Set the area of interest grid dimensions.
x | X dimension |
y | Y dimension |
z | Z dimension |
Exception | Can't change grid size in shared mode |
void SetBehaviourReplicateTo | ( | NetworkBehaviour | behaviour, |
PlayerRef | player, | ||
bool | replicate | ||
) |
Controls if a specific network behaviours state is replicated to a player or not.
behaviour | The behaviour to change replication status for |
player | The player to change replication status for |
replicate | true = replicate, false = don't replicate |
void SetBehaviourReplicateToAll | ( | NetworkBehaviour | behaviour, |
bool | replicate | ||
) |
Controls if a specific network behaviours state is replicated to all players or not.
behaviour | The behaviour to change replication status for |
replicate | true = replicate, false = don't replicate |
bool SetIsSimulated | ( | NetworkObject | obj, |
bool | simulate | ||
) |
Sets the simulation state for this object, if it takes part in the NetworkFixedUpdate, etc.
obj | the object to change state for |
simulate | true if it should be simulated, false if otherwise |
void SetMasterClient | ( | PlayerRef | player | ) |
Promote a player to be the new master client. Only the master client is able to call this method.
player | The player to be promoted to master client |
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.
player | The player |
networkObject | The object |
alwaysInterested | If he's always interested, or not. |
void SetPlayerObject | ( | PlayerRef | player, |
NetworkObject | networkObject | ||
) |
Sets the network object associated with this player.
player | PlayerRef to set the network object |
networkObject | Network object to associate with the player |
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.
prefab | A GameObject with a NetworkObject |
position | Spawn Position |
rotation | Spawn Rotation |
inputAuthority | Player Input Authority |
onBeforeSpawned | OnBeforeSpawned reference |
flags | Spawn flags |
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.
prefab | Prefab used to spawn the NetworkObject |
position | Spawn Position |
rotation | Spawn Rotation |
inputAuthority | Player Input Authority |
onBeforeSpawned | OnBeforeSpawned reference |
flags | Spawn flags |
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.
prefabGuid | Object Guid used to spawn the NetworkObject |
position | Spawn Position |
rotation | Spawn Rotation |
inputAuthority | Player Input Authority |
onBeforeSpawned | OnBeforeSpawned reference |
flags | Spawn flags |
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.
typeId | Prefab ID used to spawn the NetworkObject |
position | Spawn Position |
rotation | Spawn Rotation |
inputAuthority | Player Input Authority |
onBeforeSpawned | OnBeforeSpawned reference |
flags | Spawn flags |
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.
prefabRef | Prefab Ref used to spawn the NetworkObject |
position | Spawn Position |
rotation | Spawn Rotation |
inputAuthority | Player Input Authority |
onBeforeSpawned | OnBeforeSpawned reference |
flags | Spawn flags |
T 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
T | Must be a Type derived from SimulationBehaviour |
prefab | SimulationBehaviour used to spawn the NetworkObject |
position | Spawn Position |
rotation | Spawn Rotation |
inputAuthority | Player Input Authority |
onBeforeSpawned | OnBeforeSpawned reference |
flags | Spawn flags |
T | : | SimulationBehaviour |
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.
prefab | A GameObject with a NetworkObject |
position | Spawn Position |
rotation | Spawn Rotation |
inputAuthority | Player Input Authority |
onBeforeSpawned | OnBeforeSpawned reference |
flags | Spawn flags |
,
onCompleted | A callback to fire once the spawn is done. |
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.
prefab | Prefab used to spawn the NetworkObject |
position | Spawn Position |
rotation | Spawn Rotation |
inputAuthority | Player Input Authority |
onBeforeSpawned | OnBeforeSpawned reference |
flags | Spawn flags |
,
onCompleted | A callback to fire once the spawn is done. |
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.
prefabGuid | Object Guid used to spawn the NetworkObject |
position | Spawn Position |
rotation | Spawn Rotation |
inputAuthority | Player Input Authority |
onBeforeSpawned | OnBeforeSpawned reference |
flags | Spawn flags |
,
onCompleted | A callback to fire once the spawn is done. |
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.
typeId | Prefab ID used to spawn the NetworkObject |
position | Spawn Position |
rotation | Spawn Rotation |
inputAuthority | Player Input Authority |
onBeforeSpawned | OnBeforeSpawned reference |
flags | Spawn flags |
,
onCompleted | A callback to fire once the spawn is done. |
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.
prefabRef | Prefab Ref used to spawn the NetworkObject |
position | Spawn Position |
rotation | Spawn Rotation |
inputAuthority | Player Input Authority |
onBeforeSpawned | OnBeforeSpawned reference |
flags | Spawn flags |
,
onCompleted | A callback to fire once the spawn is done. |
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
T | Must be a Type derived from SimulationBehaviour |
prefab | SimulationBehaviour used to spawn the NetworkObject |
onCompleted | A callback to fire once the spawn is done. |
position | Spawn Position |
rotation | Spawn Rotation |
inputAuthority | Player Input Authority |
onBeforeSpawned | OnBeforeSpawned reference |
flags | Spawn flags |
T | : | SimulationBehaviour |
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
args | Custom arguments used to setup the Fusion Simulation |
bool TryFindBehaviour | ( | NetworkBehaviourId | behaviourId, |
out NetworkBehaviour | behaviour | ||
) |
Get the NetworkBehaviour instance for this NetworkRunner from a NetworkBehaviourId.
behaviourId | NetworkBehaviourId to look forward |
behaviour | NetworkBehaviour reference, if found |
bool TryFindBehaviour< T > | ( | NetworkBehaviourId | id, |
out T | behaviour | ||
) |
Try to find a NetworkBehaviour with the provided NetworkBehaviourId.
id | The NetworkBehaviourId to search for |
behaviour | The behaviour found |
T | A NetworkBehaviour type |
T | : | NetworkBehaviour |
bool TryFindObject | ( | NetworkId | objectId, |
out NetworkObject | networkObject | ||
) |
Get the NetworkObject instance for this NetworkRunner from a NetworkId.
objectId | Object NetworkID to look forward |
networkObject | NetworkObject reference, if found |
bool TryGetBehaviourStats | ( | List<(Type, BehaviourStats)> | result | ) |
Populate the provided list with all registered behaviours and their BehaviourStats.
result | The list to be populated |
bool TryGetInputForPlayer< T > | ( | PlayerRef | player, |
out T | input | ||
) |
Outputs the NetworkInput from player, translated to the indicated INetworkInput.
T | : | unmanaged | |
T | : | INetworkInput |
T TryGetNetworkedBehaviourFromNetworkedObjectRef< T > | ( | NetworkId | networkId | ) |
Tries to return the first instance of T found on the root of a NetworkObject.
T | The type of the component to search for |
networkId | NetworkId of the NetworkObject to search for |
T | : | NetworkBehaviour |
NetworkBehaviourId TryGetNetworkedBehaviourId | ( | NetworkBehaviour | behaviour | ) |
Tries to return a NetworkBehaviourId for the NetworkBehaviour provided.
behaviour | NetworkBehaviour to get the NetworkBehaviourId from |
NetworkId TryGetObjectRefFromNetworkedBehaviour | ( | NetworkBehaviour | behaviour | ) |
Tries to return the behaviour NetworkId.
behaviour | NetworkBehaviour to get the NetworkId from |
bool TryGetObjectStats | ( | NetworkId | id, |
out NetworkObjectStats | stats | ||
) |
Try to get NetworkObjectStats buffer for a NetworkObject from this NetworkRunner.
bool TryGetPhysicsInfo | ( | out NetworkPhysicsInfo | info | ) |
Try to get the physics info.
info | Network physics info |
bool TryGetPlayerObject | ( | PlayerRef | player, |
out NetworkObject | networkObject | ||
) |
Try to gets the NetworkObject associated with a specific player.
player | PlayerRef to get the network object |
networkObject | Network object if one is associated with the player |
bool TryGetPlayerStats | ( | PlayerRef | player, |
out SimulationConnectionStats | stats | ||
) |
Try to get SimulationConnectionStats buffer for a player reference from this NetworkRunner.
bool TryGetSceneInfo | ( | out NetworkSceneInfo | sceneInfo | ) |
Tries to get the NetworkSceneInfo of this NetworkRunner.
sceneInfo | The result NetworkSceneInfo |
bool TryGetSimulationStats | ( | out SimulationStats | stats | ) |
Try to get SimulationStats buffer from this NetworkRunner.
bool TrySetPhysicsInfo | ( | NetworkPhysicsInfo | info | ) |
Try to set the physics info.
info | Network physics info |
InvalidOperationException | Thrown if the runner does not have the scene authority. |
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.
prefab | A GameObject with a NetworkObject |
position | Spawn Position |
rotation | Spawn Rotation |
inputAuthority | Player Input Authority |
onBeforeSpawned | OnBeforeSpawned reference |
flags | Spawn flags |
obj | Spawned NetworkObject reference |
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.
prefab | Prefab used to spawn the NetworkObject |
position | Spawn Position |
rotation | Spawn Rotation |
inputAuthority | Player Input Authority |
onBeforeSpawned | OnBeforeSpawned reference |
flags | Spawn flags |
obj | Spawned NetworkObject reference |
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.
prefabGuid | Object Guid used to spawn the NetworkObject |
position | Spawn Position |
rotation | Spawn Rotation |
inputAuthority | Player Input Authority |
onBeforeSpawned | OnBeforeSpawned reference |
flags | Spawn flags |
obj | Spawned NetworkObject reference |
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.
typeId | Prefab ID used to spawn the NetworkObject |
position | Spawn Position |
rotation | Spawn Rotation |
inputAuthority | Player Input Authority |
onBeforeSpawned | OnBeforeSpawned reference |
flags | Spawn flags |
obj | Spawned NetworkObject reference |
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.
prefabRef | Prefab Ref used to spawn the NetworkObject |
position | Spawn Position |
rotation | Spawn Rotation |
inputAuthority | Player Input Authority |
onBeforeSpawned | OnBeforeSpawned reference |
flags | Spawn flags |
obj | Spawned NetworkObject reference |
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
T | Must be a Type derived from SimulationBehaviour |
prefab | SimulationBehaviour used to spawn the NetworkObject |
obj | Spawned NetworkObject reference |
position | Spawn Position |
rotation | Spawn Rotation |
inputAuthority | Player Input Authority |
onBeforeSpawned | OnBeforeSpawned reference |
flags | Spawn flags |
T | : | SimulationBehaviour |
NetworkSceneAsyncOp UnloadScene | ( | string | sceneName | ) |
Unloads a scene.
sceneName | Name of the scene to unload |
|
get |
Photon Client UserID.
Returns null if Peer is not connected to Photon Cloud