The primary Fusion component for networked GameObject entities. This stores the object's network identity and manages the object's state and input authority. More...
Inherits Behaviour, and ILogBuilder.
Public Member Functions | |
void | AssignInputAuthority (PlayerRef player) |
Sets which PlayerRef has Input Authority for this Object. More... | |
void | CopyStateFrom (NetworkObject source) |
Copies the entire State from another NetworkObject More... | |
void | CopyStateFromSceneObject (NetworkObjectHeaderPtr source) |
Copies the entire State from another Scene NetworkObject. They must have the same Scene Guid. More... | |
int | GetLocalAuthorityMask () |
Gets a bitmask of AuthorityMasks flags, representing the current local authority over this NetworkObject. More... | |
void | ReleaseStateAuthority () |
void | RemoveInputAuthority () |
Removes input authority from whichever player has it for this object. Only valid when called on a Host or Server peer. More... | |
void | RequestStateAuthority () |
void | SetInterestGroup (PlayerRef player, string group, bool interested) |
Add or remove Player's interest in a specific named Interest Group for this NetworkObject. More... | |
void | SetPlayerAlwaysInterested (PlayerRef player, bool alwaysInterested) |
Add or remove specific player interest in this NetworkObject. 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 void | NetworkUnwrap (NetworkRunner runner, NetworkId wrapper, ref NetworkObject result) |
static NetworkId | NetworkWrap (NetworkRunner runner, NetworkObject obj) |
static implicit | operator NetworkId (NetworkObject obj) |
Static Public Member Functions inherited from Behaviour | |
static void | DestroyBehaviour (Behaviour behaviour) |
Wrapper for Unity's GameObject.Destroy() More... | |
Public Attributes | |
NetworkObjectFlags | Flags |
Flags used for network object prefabs and similar More... | |
NetworkId | Id |
The unique identifier for this network entity. More... | |
bool | IsResume |
Signal that this NetworkObject comes from a Resume Spawn More... | |
NetworkObject[] | NestedObjects |
Array of initial child nested NetworkObject entities, that are children of this Object. More... | |
NetworkBehaviour[] | NetworkedBehaviours |
Array of all NetworkBehaviours associated with this network entity. More... | |
NetworkObjectGuid | NetworkGuid |
The GUID for this prefab or scene object, which is set at development time. Used to reference this as a spawnable object. All spawned instances of this object will retain this GUID. Use NetworkId for the unique ID of network entries. More... | |
PredictionData | PredictedSpawn |
NetworkRunner | Runner |
The NetworkRunner this entity is associated with. More... | |
SimulationBehaviour[] | SimulationBehaviours |
Array of all SimulationBehaviours associated with this network entity. This does not include NetworkBehaviour derived classes, as they are stored in NetworkedBehaviours. More... | |
Static Public Attributes | |
const int | DefaultExecutionOrder = 500 |
Protected Member Functions | |
virtual void | Awake () |
virtual void | OnDestroy () |
Properties | |
int | AreaOfInterestLayerMask [get] |
The layers this object exists in for area of interest queries. This is an integer bitmask not a layer index. More... | |
bool | HasInputAuthority [get] |
Returns if Simulation.LocalPlayer is the designated Input Authority for this network entity. More... | |
bool | HasStateAuthority [get] |
Returns if Simulation.LocalPlayer is the designated State Authority for this network entity. More... | |
PlayerRef | InputAuthority [get] |
Returns the PlayerRef that has Input Authority over this network entity. 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... | |
bool | IsInSimulation [get] |
If this object is inserted into the simulation More... | |
bool | IsPredictedDespawn [get] |
If this is a predicted spawned object More... | |
bool | IsPredictedSpawn [get] |
If this is a predicted spawned object More... | |
bool | IsProxy [get] |
Returns if Simulation.LocalPlayer is neither the Input nor State Authority for this network entity. More... | |
bool | IsSceneObject [get] |
Returns true if this network entity existed as part of a scene, rather than having been dynamically spawned. More... | |
bool | IsSpawnable [get, set] |
Toggles if this NetworkObject is included in the NetworkProjectConfig.PrefabTable, which will include the prefab in builds as a Spawnable object. More... | |
bool | IsSpawnedPrefabNestedObject [get] |
Returns true if this network entity is a spawned prefab's nested object, rather than being a scene object or a root prefab object. More... | |
bool | IsSpawnedPrefabRoot [get] |
Returns true if this network entity is a spawned prefab's root, rather than being a scene object or a nested prefab object. More... | |
bool | IsValid [get] |
Returns if this network entity is associated with its NetworkRunner, and that runner is not null. More... | |
Tick | LastReceiveTick [get] |
Last tick this object received an update. Only available for SimulationConfig.StateReplicationModes.EventualConsistency. More... | |
string | Name [get] |
The ID + Unity GameObject name for this entity. More... | |
PlayerRef | StateAuthority [get] |
Returns the PlayerRef that has State Authority over this network entity. 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... | |
The primary Fusion component for networked GameObject entities. This stores the object's network identity and manages the object's state and input authority.
void AssignInputAuthority | ( | PlayerRef | player | ) |
Sets which PlayerRef has Input Authority for this Object.
void CopyStateFrom | ( | NetworkObject | source | ) |
Copies the entire State from another NetworkObject
source | NetworkObject to copy the State from |
void CopyStateFromSceneObject | ( | NetworkObjectHeaderPtr | source | ) |
Copies the entire State from another Scene NetworkObject. They must have the same Scene Guid.
source | Scene NetworkObject to copy the State from. |
int GetLocalAuthorityMask | ( | ) |
Gets a bitmask of AuthorityMasks flags, representing the current local authority over this NetworkObject.
void RemoveInputAuthority | ( | ) |
Removes input authority from whichever player has it for this object. Only valid when called on a Host or Server peer.
void SetInterestGroup | ( | PlayerRef | player, |
string | group, | ||
bool | interested | ||
) |
Add or remove Player's interest in a specific named Interest Group for this NetworkObject.
SimulationConfig.ReplicationMode must be set to SimulationConfig.StateReplicationModes.EventualConsistency.
void SetPlayerAlwaysInterested | ( | PlayerRef | player, |
bool | alwaysInterested | ||
) |
Add or remove specific player interest in this NetworkObject.
SimulationConfig.ReplicationMode must be set to SimulationConfig.StateReplicationModes.EventualConsistency.
player | |
alwaysInterested |
NetworkObjectFlags Flags |
Flags used for network object prefabs and similar
NetworkId Id |
The unique identifier for this network entity.
bool IsResume |
Signal that this NetworkObject comes from a Resume Spawn
NetworkObject [] NestedObjects |
Array of initial child nested NetworkObject entities, that are children of this Object.
NetworkBehaviour [] NetworkedBehaviours |
Array of all NetworkBehaviours associated with this network entity.
NetworkObjectGuid NetworkGuid |
The GUID for this prefab or scene object, which is set at development time. Used to reference this as a spawnable object. All spawned instances of this object will retain this GUID. Use NetworkId for the unique ID of network entries.
PredictionData PredictedSpawn |
NetworkRunner Runner |
The NetworkRunner this entity is associated with.
SimulationBehaviour [] SimulationBehaviours |
Array of all SimulationBehaviours associated with this network entity. This does not include NetworkBehaviour derived classes, as they are stored in NetworkedBehaviours.
|
get |
The layers this object exists in for area of interest queries. This is an integer bitmask not a layer index.
|
get |
Returns if Simulation.LocalPlayer is the designated Input Authority for this network entity.
|
get |
Returns if Simulation.LocalPlayer is the designated State Authority for this network entity.
|
get |
Returns the PlayerRef that has Input Authority over this network entity. 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 |
If this object is inserted into the simulation
|
get |
If this is a predicted spawned object
|
get |
If this is a predicted spawned object
|
get |
Returns if Simulation.LocalPlayer is neither the Input nor State Authority for this network entity.
|
get |
Returns true if this network entity existed as part of a scene, rather than having been dynamically spawned.
|
getset |
Toggles if this NetworkObject is included in the NetworkProjectConfig.PrefabTable, which will include the prefab in builds as a Spawnable object.
|
get |
Returns true if this network entity is a spawned prefab's nested object, rather than being a scene object or a root prefab object.
|
get |
Returns true if this network entity is a spawned prefab's root, rather than being a scene object or a nested prefab object.
|
get |
Returns if this network entity is associated with its NetworkRunner, and that runner is not null.
|
get |
Last tick this object received an update. Only available for SimulationConfig.StateReplicationModes.EventualConsistency.
|
get |
The ID + Unity GameObject name for this entity.
|
get |
Returns the PlayerRef that has State Authority over this network entity. 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.