Represents a Server or Client Simulation. More...
Inherits Behaviour, ILogBuilder, ILogBuilder, 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< T > () |
T | AddOrGetGlobal< T > () |
Ensures that a specific SimulationBehaviour component exists on this NetworkRunner gameobject. More... | |
void | AddPlayerAreaOfInterest (PlayerRef player, Vector3 position, float extent, int layersMask=-1) |
Adds an area of interest region for a specific player. A player can have multiple areas of interest regions added. These are cleared every tick, so this needs to be called every NetworkBehaviour.FixedUpdateNetwork(). More... | |
void | AddSimulationBehaviour (SimulationBehaviour behaviour, NetworkObject obj=null) |
Register a SimulationBehaviour instance with the SimulationBehaviourUpdater. Invalid if NetworkRunner has not been started and initialized. More... | |
void | Attach (NetworkObject networkObject, PlayerRef? inputAuthority=null) |
Attaches a user created network object to the network 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, bool allowPredicted=false) |
Destroys a NetworkObject. More... | |
void | Disconnect (PlayerRef player) |
Disconnect a player from the server More... | |
bool | EnsureRunnerSceneIsActive (out Scene previousActiveScene) |
If running in NetworkProjectConfig.PeerModes.Multiple peer mode and the current active scene is different than MultiplePeerUnityScene, switches active scene to MultiplePeerUnityScene, stores the previous active scene in previousActiveScene and returns true. Returns false otherwise. More... | |
bool | Exists (NetworkId id) |
Returns if the Fusion.Simulation contains a NetworkObject with given id in the current State SimulationSnapshot. More... | |
bool | Exists (NetworkObject obj) |
Returns if the Fusion.Simulation contains a reference to a NetworkObject in the current State SimulationSnapshot. More... | |
NetworkObject | FindObject (NetworkId oref) |
Get the NetworkObject instance for this NetworkRunner from a NetworkId. More... | |
SimulationBehaviour[] | GetAllBehaviours (Type type) |
Returns array of all SimulationBehaviour registered with this NetworkRunner. More... | |
List< T > | GetAllBehaviours< T > () |
void | GetAllBehaviours< T > (List< T > result) |
T | GetGlobal< T > () |
int | GetHashCodeForLogger () |
T? | GetInputForPlayer< T > (PlayerRef player) |
Returns the NetworkInput data from player, converted to the indicated INetworkInput. More... | |
SimulationBehaviour | GetInterfaceListHead (Type type, int index) |
SimulationBehaviourListScope | GetInterfaceListHead (Type type, int index, out SimulationBehaviour head) |
SimulationBehaviour | GetInterfaceListNext (SimulationBehaviour behaviour) |
SimulationBehaviour | GetInterfaceListPrev (SimulationBehaviour behaviour) |
int | GetInterfaceListsCount (Type type) |
bool | GetInterpolationData (NetworkBehaviour behaviour, bool predicted, out InterpolationData data) |
Gets the InterpolationData for the current SimulationStages stage. For use in the NetworkBehaviour.Render() callback. 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... | |
NetworkInput? | GetRawInputForPlayer (PlayerRef player) |
Returns the unconverted unsafe NetworkInput for the indicated player. More... | |
IEnumerable< NetworkObject > | GetResumeSnapshotNetworkObjects () |
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) |
bool | HasAnyActiveConnections () |
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... | |
T | InstantiateInRunnerScene< T > (T original) |
Instantiates an object in the scene of this runner More... | |
T | InstantiateInRunnerScene< T > (T original, Vector3 position, Quaternion rotation) |
Instantiates an object in the scene of this runner More... | |
void | InvokeSceneLoadDone () |
Invoke INetworkRunnerCallbacks.OnSceneLoadDone(NetworkRunner) on all implementations More... | |
void | InvokeSceneLoadStart () |
Invoke INetworkRunnerCallbacks.OnSceneLoadStart(NetworkRunner) on all implementations More... | |
bool | IsPlayerActive (PlayerRef player) |
bool | IsPlayerValid (PlayerRef player) |
async Task< StartGameResult > | JoinSessionLobby (SessionLobby sessionLobby, string lobbyID=null, AuthenticationValues authentication=null, AppSettings customAppSettings=null, bool? useDefaultCloudPorts=false, bool useCachedRegions=false) |
Join the Peer to a specific Lobby, either a prebuild or a custom one. More... | |
void | MoveToRunnerScene (GameObject go) |
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 | OnBeforeSpawned (NetworkRunner runner, NetworkObject obj) |
Delegate type for on before spawned callback More... | |
Task< bool > | PushHostMigrationSnapshot () |
Compute and send a Host Migration Snapshot to the Photon Cloud More... | |
void | RegisterSceneObjects (IEnumerable< NetworkObject > objects) |
void | RegisterUniqueObjects (IEnumerable< NetworkObject > objects) |
void | RemoveCallbacks (params INetworkRunnerCallbacks[] callbacks) |
Unregister an INetworkRunnerCallbacks instance for callbacks from this NetworkRunner. More... | |
void | RemoveGlobal< T > () |
Removes a specific SimulationBehaviour from this NetworkRunner gameobject, if it exists. More... | |
void | RemoveSimulationBehavior (SimulationBehaviour behaviour) |
Unregister a SimulationBehaviour instance from the SimulationBehaviourUpdater callbacks. Invalid if NetworkRunner has not been started and initialized. More... | |
void | SendReliableDataToPlayer (PlayerRef player, byte[] data) |
Send an arbitrary data buffer to a target Player More... | |
void | SendReliableDataToServer (byte[] data) |
Send an arbitrary 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 | SetActiveScene (SceneRef scene) |
Update the current Active Scene More... | |
void | SetInterestGroup (NetworkObject obj, PlayerRef player, string group, bool interested) |
Add or remove Player's interest in a specific named Interest Group for a specific NetworkObject. SimulationConfig.ReplicationMode must be set to SimulationConfig.StateReplicationModes.EventualConsistency. 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. More... | |
void | SetPlayerObject (PlayerRef player, NetworkObject networkObject) |
Sets the network object associated with this player More... | |
bool | SetSimulationState (NetworkObject obj, bool simulate) |
Sets the simulation state for this object, if it takes part in the NetworkFixedUpdate, etc. 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, NetworkObjectPredictionKey? predictionKey=null, bool syncPhysics=true) |
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, NetworkObjectPredictionKey? predictionKey=null, bool syncPhysics=true) |
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 NetworkPositionRotation, or any of its derived classes such as NetworkTransform to replicate the initial transform state. More... | |
NetworkObject | Spawn (NetworkObjectGuid prefabGuid, Vector3? position=null, Quaternion? rotation=null, PlayerRef? inputAuthority=null, OnBeforeSpawned onBeforeSpawned=null, NetworkObjectPredictionKey? predictionKey=null, bool syncPhysics=true) |
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 NetworkPositionRotation, or any of its derived classes such as NetworkTransform to replicate the initial transform state. More... | |
NetworkObject | Spawn (NetworkPrefabAsset prefabAsset, Vector3? position=null, Quaternion? rotation=null, PlayerRef? inputAuthority=null, OnBeforeSpawned onBeforeSpawned=null, NetworkObjectPredictionKey? predictionKey=null) |
Attempts to network instantiate a NetworkObject using a NetworkPrefabAsset Note: position and rotation values are only used locally for the instantiation of the object, and are not inherently networked. Use NetworkPositionRotation, or any of its derived classes such as NetworkTransform to replicate the initial transform state. More... | |
NetworkObject | Spawn (NetworkPrefabId prefabId, Vector3? position=null, Quaternion? rotation=null, PlayerRef? inputAuthority=null, OnBeforeSpawned onBeforeSpawned=null, NetworkObjectPredictionKey? predictionKey=null, bool syncPhysics=true, NetworkObject resumeNO=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 NetworkPositionRotation, or any of its derived classes such as NetworkTransform to replicate the initial transform state. More... | |
NetworkObject | Spawn (NetworkPrefabRef prefabRef, Vector3? position=null, Quaternion? rotation=null, PlayerRef? inputAuthority=null, OnBeforeSpawned onBeforeSpawned=null, NetworkObjectPredictionKey? predictionKey=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 NetworkPositionRotation, or any of its derived classes such as NetworkTransform to replicate the initial transform state. More... | |
T | Spawn< T > (T prefab, Vector3? position=null, Quaternion? rotation=null, PlayerRef? inputAuthority=null, OnBeforeSpawned onBeforeSpawned=null, NetworkObjectPredictionKey? predictionKey=null, bool syncPhysics=true) |
Attempts to network instantiate a NetworkObject using a Component type that is part of a NetworkObject More... | |
Task< StartGameResult > | StartGame (StartGameArgs args) |
Starts the local Fusion Runner and takes care of all major setup necessary More... | |
bool | TryFindBehaviour (NetworkBehaviourId bref, out NetworkBehaviour behaviour) |
Get the NetworkBehaviour instance for this NetworkRunner from a NetworkBehaviourId. More... | |
bool | TryFindBehaviour< T > (NetworkBehaviourId id, out T behaviour) |
bool | TryFindObject (NetworkId oref, out NetworkObject obj) |
Get the NetworkObject instance for this NetworkRunner from a NetworkId. More... | |
bool | TryGetInputForPlayer< T > (PlayerRef player, out T input) |
Outputs the NetworkInput from player, translated to the indicated INetworkInput. More... | |
T | TryGetNetworkedBehaviourFromNetworkedObjectRef< T > (NetworkId id) |
Tries to return the first instance of T found on the root of a NetworkObject. More... | |
NetworkBehaviourId | TryGetNetworkedBehaviourId (NetworkBehaviour behaviour) |
NetworkId | TryGetObjectRefFromNetworkedBehaviour (NetworkBehaviour behaviour) |
bool | TryGetPlayerObject (PlayerRef player, out NetworkObject networkObject) |
bool | TryMultiplePeerAssignTempScene () |
Try to create a temp empty scene for PhysicsScene More... | |
Public Member Functions inherited from Behaviour | |
T | AddBehaviour< T > () |
Wrapper for Unity's GameObject.AddComponent() More... | |
T | 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 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 Simulation.IDeltaCompressor | BurstDeltaCompressor |
static CloudConnectionLostHandler | CloudConnectionLost |
Properties | |
IEnumerable< PlayerRef > | ActivePlayers [get] |
Returns the collection of PlayerRef objects for this NetworkRunner's Fusion.Simulation. 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... | |
NetworkProjectConfig | Config [get] |
Returns the NetworkProjectConfig reference. More... | |
ConnectionType | CurrentConnectionType [get] |
Check the current Connection Type with the Remote Server More... | |
SceneRef | CurrentScene [get] |
Returns the current loaded network scene. More... | |
float | DeltaTime [get] |
Returns the fixed tick time interval. Derived from the SimulationConfig.TickRate. More... | |
GameMode | GameMode [get] |
Current Game Mode active on the Fusion Simulation More... | |
static IReadOnlyList< NetworkRunner > | Instances [get] |
A list of all NetworkRunners. More... | |
float | InterpolationRenderTime [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... | |
bool | IsClient [get] |
Returns if this Fusion.Simulation represents a Client connection. More... | |
bool | IsCloudReady [get] |
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 | IsHostMigrationEnabled [get] |
Signal if Fusion was initilized with Host Migration system enabled More... | |
bool | IsInSession [get] |
bool | IsLastTick [get] |
If this is the last tick that is being executed this update More... | |
bool | IsMultiplePeerSceneTemp [get] |
Signal if this Runner is already in a Temp Physics Scene 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 | 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 | IsSinglePlayer [get] |
Returns true if this runner was started as single player (Started as SimulationModes.Host with SimulationConfig.DefaultPlayers = 1). More... | |
bool | IsStarting [get] |
If the runner is pending to start More... | |
bool | IsVisible [get, set] |
Change the visibility of this NetworkRunner when running in Multiple Peer Mode More... | |
HitboxManager | LagCompensation [get] |
Returns the global instance of a lag compensation buffer Fusion.HitboxManager. More... | |
LobbyInfo | LobbyInfo = new LobbyInfo() [get] |
Signal if the local peer is already inside a Lobby More... | |
PlayerRef | LocalPlayer [get] |
Returns a PlayerRef for the local simulation. For a dedicated server PlayerRef.IsValid 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... | |
SimulationModes | Mode [get] |
Returns the SimulationModes flags for The type of network peer the associated Fusion.Simulation represents. More... | |
Scene | MultiplePeerUnityScene [get, set] |
A scene used when run in NetworkProjectConfig.PeerModes.Multiple mode. More... | |
NATType | NATType [get] |
Exposes the current NAT Type from the local Peer More... | |
INetworkObjectPool | ObjectPool [get] |
Returns the INetworkObjectPool instance. More... | |
bool | ProvideInput [get, set] |
Indicates if this NetworkRunner is collecting PlayerRef INetworkInput. More... | |
INetworkSceneManager | SceneManager [get] |
Returns the INetworkSceneManager instance. More... | |
SessionInfo | SessionInfo = new SessionInfo() [get] |
Stores information about the current running session More... | |
Simulation | Simulation [get] |
Returns the Fusion.Simulation for this NetworkRunner. More... | |
float | SimulationRenderTime [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... | |
float | SimulationTime [get] |
The time the current State SimulationSnapshot 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] |
Returns the Unity scene for this NetworkRunner. With NetworkProjectConfig.PeerModes.Multiple, multiple physics scenes may exist, and this getter should be used in place of SceneManager.GetActiveScene(). 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 | TicksExecuted [get] |
Returns how many ticks we executed last update. More... | |
SimulationConfig.Topologies | Topology [get] |
The current topology used More... | |
string | UserId [get] |
Represents a Server or Client Simulation.
All Scene related API and fields
Host Migration related code in order to get a copy of the Simulation State
|
strong |
|
strong |
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 |
T AddOrGetGlobal< T > | ( | ) |
Ensures that a specific SimulationBehaviour component exists on this NetworkRunner gameobject.
T | : | SimulationBehaviour |
void AddPlayerAreaOfInterest | ( | PlayerRef | player, |
Vector3 | position, | ||
float | extent, | ||
int | layersMask = -1 |
||
) |
Adds an area of interest region for a specific player. A player can have multiple areas of interest regions added. These are cleared every tick, so this needs to be called every NetworkBehaviour.FixedUpdateNetwork().
player | The player |
position | Center position of the area of interest |
extent | The extents of the area of interest. |
void AddSimulationBehaviour | ( | SimulationBehaviour | behaviour, |
NetworkObject | obj = null |
||
) |
Register a SimulationBehaviour instance with the SimulationBehaviourUpdater. Invalid if NetworkRunner has not been started and initialized.
void Attach | ( | NetworkObject | networkObject, |
PlayerRef? | inputAuthority = null |
||
) |
Attaches a user created network object to the network
networkObject | The object to attach |
inputAuthority | If assigned who is the default input authority for this object |
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.
networkRunner | NetworkRunner instance |
shutdownReason | Shutdown reason for the connection loss |
reconnecting | Flag to signal if the peer is attempting to reconnect to the Photon Cloud |
void Despawn | ( | NetworkObject | networkObject, |
bool | allowPredicted = false |
||
) |
Destroys a NetworkObject.
networkObject |
void Disconnect | ( | PlayerRef | player | ) |
Disconnect a player from the server
player | Player to disconnect |
bool EnsureRunnerSceneIsActive | ( | out Scene | previousActiveScene | ) |
If running in NetworkProjectConfig.PeerModes.Multiple peer mode and the current active scene is different than MultiplePeerUnityScene, switches active scene to MultiplePeerUnityScene, stores the previous active scene in previousActiveScene and returns true. Returns false otherwise.
previousActiveScene |
bool Exists | ( | NetworkId | id | ) |
Returns if the Fusion.Simulation contains a NetworkObject with given id in the current State SimulationSnapshot.
bool Exists | ( | NetworkObject | obj | ) |
Returns if the Fusion.Simulation contains a reference to a NetworkObject in the current State SimulationSnapshot.
NetworkObject FindObject | ( | NetworkId | oref | ) |
Get the NetworkObject instance for this NetworkRunner from a NetworkId.
oref |
SimulationBehaviour [] GetAllBehaviours | ( | Type | type | ) |
Returns array of all SimulationBehaviour registered with this NetworkRunner.
type |
T? GetInputForPlayer< T > | ( | PlayerRef | player | ) |
Returns the NetworkInput data from player, converted to the indicated INetworkInput.
T | : | unmanaged | |
T | : | INetworkInput |
|
static |
Get enumerator for the collection of all NetworkRunners. Allows to enumerate alloc-free.
bool GetInterpolationData | ( | NetworkBehaviour | behaviour, |
bool | predicted, | ||
out InterpolationData | data | ||
) |
Gets the InterpolationData for the current SimulationStages stage. For use in the NetworkBehaviour.Render() callback.
behaviour | |
predicted | Indicate if the start and end ticks should represent predicted, or state snapshots. |
data |
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 | ) |
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 |
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. |
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
|
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 |
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 | : | Component |
T InstantiateInRunnerScene< T > | ( | T | original, |
Vector3 | position, | ||
Quaternion | rotation | ||
) |
Instantiates an object in the scene of this runner
T | : | Component |
void InvokeSceneLoadDone | ( | ) |
Invoke INetworkRunnerCallbacks.OnSceneLoadDone(NetworkRunner) on all implementations
void InvokeSceneLoadStart | ( | ) |
Invoke INetworkRunnerCallbacks.OnSceneLoadStart(NetworkRunner) on all implementations
bool IsPlayerActive | ( | PlayerRef | player | ) |
player |
bool IsPlayerValid | ( | PlayerRef | player | ) |
player |
async Task<StartGameResult> JoinSessionLobby | ( | SessionLobby | sessionLobby, |
string | lobbyID = null , |
||
AuthenticationValues | authentication = null , |
||
AppSettings | customAppSettings = null , |
||
bool? | useDefaultCloudPorts = false , |
||
bool | useCachedRegions = false |
||
) |
Join the Peer to a specific Lobby, either a prebuild or a custom one.
More about matchmaking: https://doc.photonengine.com/fusion/v1/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 |
useCachedRegions | Signal if the cached regions ping should be used to speed up connection |
void MoveToRunnerScene | ( | GameObject | go | ) |
Moves an object to the scene of this runner
go | Object to move |
void MoveToRunnerScene< T > | ( | T | component | ) |
Moves an object to the scene of this runner
T |
component | Component of object to move |
T | : | Component |
delegate void OnBeforeSpawned | ( | NetworkRunner | runner, |
NetworkObject | obj | ||
) |
Delegate type for on before spawned callback
Task<bool> PushHostMigrationSnapshot | ( | ) |
Compute and send a Host Migration Snapshot to the Photon Cloud
void RemoveCallbacks | ( | params INetworkRunnerCallbacks[] | callbacks | ) |
Unregister an INetworkRunnerCallbacks instance for callbacks from this NetworkRunner.
callbacks |
void RemoveGlobal< T > | ( | ) |
Removes a specific SimulationBehaviour from this NetworkRunner gameobject, if it exists.
T | : | SimulationBehaviour |
void RemoveSimulationBehavior | ( | SimulationBehaviour | behaviour | ) |
Unregister a SimulationBehaviour instance from the SimulationBehaviourUpdater callbacks. Invalid if NetworkRunner has not been started and initialized.
void SendReliableDataToPlayer | ( | PlayerRef | player, |
byte[] | data | ||
) |
Send an arbitrary data buffer to a target Player
player | Player that should receive the buffer |
data | Buffer to be sent |
void SendReliableDataToServer | ( | byte[] | data | ) |
Send an arbitrary data buffer to the Server
data | Buffer to be sent |
void SendRpc | ( | SimulationMessage * | message | ) |
Sends RPC message. Not meant to be used directly, ILWeaver calls this.
message |
void SendRpc | ( | SimulationMessage * | message, |
out RpcSendResult | info | ||
) |
Sends RPC message. Not meant to be used directly, ILWeaver calls this.
message | |
info |
void SetActiveScene | ( | SceneRef | scene | ) |
Update the current Active Scene
scene | SceneRef to be activated |
void SetInterestGroup | ( | NetworkObject | obj, |
PlayerRef | player, | ||
string | group, | ||
bool | interested | ||
) |
Add or remove Player's interest in a specific named Interest Group for a specific NetworkObject.
SimulationConfig.ReplicationMode must be set to SimulationConfig.StateReplicationModes.EventualConsistency.
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.
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 | |
networkObject |
bool SetSimulationState | ( | 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 |
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 , |
||
NetworkObjectPredictionKey? | predictionKey = null , |
||
bool | syncPhysics = true |
||
) |
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 |
predictionKey | NetworkObjectPredictionKey reference |
syncPhysics | If Physics.SyncTransforms and Physics2D.SyncTransforms should be called after setting the network object position and/or rotation , if provided. |
NetworkObject Spawn | ( | NetworkObject | prefab, |
Vector3? | position = null , |
||
Quaternion? | rotation = null , |
||
PlayerRef? | inputAuthority = null , |
||
OnBeforeSpawned | onBeforeSpawned = null , |
||
NetworkObjectPredictionKey? | predictionKey = null , |
||
bool | syncPhysics = true |
||
) |
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 NetworkPositionRotation, or any of its derived classes such as NetworkTransform 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 |
predictionKey | NetworkObjectPredictionKey reference |
syncPhysics | If Physics.SyncTransforms and Physics2D.SyncTransforms should be called after setting the network object position and/or rotation , if provided. |
NetworkObject Spawn | ( | NetworkObjectGuid | prefabGuid, |
Vector3? | position = null , |
||
Quaternion? | rotation = null , |
||
PlayerRef? | inputAuthority = null , |
||
OnBeforeSpawned | onBeforeSpawned = null , |
||
NetworkObjectPredictionKey? | predictionKey = null , |
||
bool | syncPhysics = true |
||
) |
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 NetworkPositionRotation, or any of its derived classes such as NetworkTransform 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 |
predictionKey | NetworkObjectPredictionKey reference |
syncPhysics | If Physics.SyncTransforms and Physics2D.SyncTransforms should be called after setting the network object position and/or rotation , if provided. |
NetworkObject Spawn | ( | NetworkPrefabAsset | prefabAsset, |
Vector3? | position = null , |
||
Quaternion? | rotation = null , |
||
PlayerRef? | inputAuthority = null , |
||
OnBeforeSpawned | onBeforeSpawned = null , |
||
NetworkObjectPredictionKey? | predictionKey = null |
||
) |
Attempts to network instantiate a NetworkObject using a NetworkPrefabAsset Note: position and rotation values are only used locally for the instantiation of the object, and are not inherently networked. Use NetworkPositionRotation, or any of its derived classes such as NetworkTransform to replicate the initial transform state.
prefabAsset | Prefab Asset used to spawn the NetworkObject |
position | Spawn Position |
rotation | Spawn Rotation |
inputAuthority | Player Input Authority |
onBeforeSpawned | OnBeforeSpawned reference |
predictionKey | NetworkObjectPredictionKey reference |
NetworkObject Spawn | ( | NetworkPrefabId | prefabId, |
Vector3? | position = null , |
||
Quaternion? | rotation = null , |
||
PlayerRef? | inputAuthority = null , |
||
OnBeforeSpawned | onBeforeSpawned = null , |
||
NetworkObjectPredictionKey? | predictionKey = null , |
||
bool | syncPhysics = true , |
||
NetworkObject | resumeNO = 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 NetworkPositionRotation, or any of its derived classes such as NetworkTransform to replicate the initial transform state.
prefabId | Prefab ID used to spawn the NetworkObject |
position | Spawn Position |
rotation | Spawn Rotation |
inputAuthority | Player Input Authority |
onBeforeSpawned | OnBeforeSpawned reference |
predictionKey | NetworkObjectPredictionKey reference |
syncPhysics | If Physics.SyncTransforms and Physics2D.SyncTransforms should be called after setting the network object position and/or rotation , if provided. |
resumeNO | Used as reference when re-creating the NetworkObject from a old simulation. Accepted only when resuming from a Host Migration. |
NetworkObject Spawn | ( | NetworkPrefabRef | prefabRef, |
Vector3? | position = null , |
||
Quaternion? | rotation = null , |
||
PlayerRef? | inputAuthority = null , |
||
OnBeforeSpawned | onBeforeSpawned = null , |
||
NetworkObjectPredictionKey? | predictionKey = 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 NetworkPositionRotation, or any of its derived classes such as NetworkTransform 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 |
predictionKey | NetworkObjectPredictionKey reference |
T Spawn< T > | ( | T | prefab, |
Vector3? | position = null , |
||
Quaternion? | rotation = null , |
||
PlayerRef? | inputAuthority = null , |
||
OnBeforeSpawned | onBeforeSpawned = null , |
||
NetworkObjectPredictionKey? | predictionKey = null , |
||
bool | syncPhysics = true |
||
) |
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 |
predictionKey | NetworkObjectPredictionKey reference |
syncPhysics | If Physics.SyncTransforms and Physics2D.SyncTransforms should be called after setting the network object position and/or rotation , if provided. |
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/fusion/v1/manual/matchmaking
args | Custom arguments used to setup the Fusion Simulation |
bool TryFindBehaviour | ( | NetworkBehaviourId | bref, |
out NetworkBehaviour | behaviour | ||
) |
Get the NetworkBehaviour instance for this NetworkRunner from a NetworkBehaviourId.
bref | |
behaviour |
bool TryFindObject | ( | NetworkId | oref, |
out NetworkObject | obj | ||
) |
Get the NetworkObject instance for this NetworkRunner from a NetworkId.
oref | |
obj |
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 | id | ) |
Tries to return the first instance of T found on the root of a NetworkObject.
T |
id |
T | : | NetworkBehaviour |
bool TryMultiplePeerAssignTempScene | ( | ) |
Try to create a temp empty scene for PhysicsScene
|
get |
Returns the collection of PlayerRef objects for this NetworkRunner's Fusion.Simulation.
|
get |
AuthenticationValues used by this Runner to Authenticate the local peer.
|
staticget |
Get Fusion.Runtime.dll build type.
|
get |
Returns the NetworkProjectConfig reference.
|
get |
Check the current Connection Type with the Remote Server
|
get |
Returns the current loaded network scene.
|
get |
Returns the fixed tick time interval. Derived from the SimulationConfig.TickRate.
Current Game Mode active on the Fusion Simulation
|
staticget |
A list of all NetworkRunners.
|
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).
|
get |
Returns if this Fusion.Simulation represents a Client connection.
|
get |
Returns if this Client is currently connected to a Remote Server
|
get |
If this is the first tick that executes this update or re-simulation
|
get |
If this is not a re-simulation but a new forward tick
|
get |
Signal if Fusion was initilized with Host Migration system enabled
|
get |
If this is the last tick that is being executed this update
|
get |
Signal if this Runner is already in a Temp Physics Scene
|
get |
Returns true if this runner represents a Client or Host. Dedicated servers have no local player and will return false.
|
get |
If we are currently executing a client side prediction re-simulation.
|
get |
if this instance is a resume (host migration)
|
get |
Returns if this Fusion.Simulation is valid and running.
|
get |
Returns if this Fusion.Simulation represents a Server connection.
|
get |
Signal if the Local Peer is in a Room and is the Room Master Client
|
get |
If the runner is shutdown
|
get |
Returns true if this runner was started as single player (Started as SimulationModes.Host with SimulationConfig.DefaultPlayers = 1).
|
get |
If the runner is pending to start
|
getset |
Change the visibility of this NetworkRunner when running in Multiple Peer Mode
|
get |
Returns the global instance of a lag compensation buffer Fusion.HitboxManager.
|
get |
Returns a PlayerRef for the local simulation. For a dedicated server PlayerRef.IsValid 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.
|
get |
Returns the SimulationModes flags for The type of network peer the associated Fusion.Simulation represents.
|
getset |
A scene used when run in NetworkProjectConfig.PeerModes.Multiple mode.
|
get |
Returns the INetworkObjectPool instance.
|
getset |
Indicates if this NetworkRunner is collecting PlayerRef INetworkInput.
|
get |
Returns the INetworkSceneManager instance.
|
get |
Stores information about the current running session
|
get |
Returns the Fusion.Simulation for this NetworkRunner.
|
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).
|
get |
The time the current State SimulationSnapshot 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).
|
get |
Returns the Unity scene for this NetworkRunner. With NetworkProjectConfig.PeerModes.Multiple, multiple physics scenes may exist, and this getter should be used in place of SceneManager.GetActiveScene().
|
get |
Returns the current SimulationStages stage of this Fusion.Simulation.
|
get |
The current state of the runner, if it's Starting, Running, Shutdown
|
get |
The tick associated with the current state of networked objects, or the current simulation tick being processed (when evaluated during FixedUpdateNetwork).
|
get |
Returns how many ticks we executed last update.
|
get |
The current topology used
|
get |
Returns null if Peer is not connected to Photon Cloud