Class NetworkObject
A component used to identify that a GameObject in the network
Inherited Members
Namespace: Unity.Netcode
Assembly: solution.dll
Syntax
[AddComponentMenu("Netcode/Network Object", -99)]
[DisallowMultipleComponent]
public sealed class NetworkObject : MonoBehaviour
Fields
Name | Description |
---|---|
Active |
When set to true and the active scene is changed, this will automatically migrate the Network |
Always |
If true, the object will always be replicated as root on clients and the parent will be ignored. |
Auto |
Whether or not to enable automatic NetworkObject parent synchronization. |
Check |
Delegate invoked when the netcode needs to know if the object should be visible to a client, if null it will assume true |
Dont |
Whether or not to destroy this object if it's owner is destroyed. If true, the objects ownership will be given to the server. |
Include |
Delegate invoked when the netcode needs to know if it should include the transform when spawning the object, if null it will assume true |
On |
Notifies when the NetworkObject is migrated into a new scene |
Scene |
When enabled (the default), if a Network |
Spawn |
When set to false, the NetworkObject will be spawned with no observers initially (other than the server) |
Synchronize |
Determines if the associated NetworkObject's transform will get synchronized when spawned. |
Properties
Name | Description |
---|---|
Destroy |
Gets whether or not the object should be automatically removed when the scene is unloaded. |
Is |
Gets if the object is the personal clients player object |
Is |
Gets Whether or not the object is owned by anyone |
Is |
Gets if the object is owned by the local player or if the object is the local player object |
Is |
Gets if this object is a player object |
Is |
Gets if the object is a SceneObject, null if it's not yet spawned but is a scene object. |
Is |
Gets if the object has yet been spawned across the network |
Network |
Gets the NetworkManager that owns this NetworkObject instance |
Network |
Gets the unique Id of this object that is synced across the network |
Owner |
Gets the ClientId of the owner of this NetworkObject |
Prefab |
Gets the Prefab Hash Id of this object if the object is registerd as a prefab otherwise it returns 0 |
Methods
Name | Description |
---|---|
Change |
Changes the owner of the object. Can only be called from server |
Despawn(bool) | Despawns the Game |
Get |
|
Get |
Returns Observers enumerator |
Is |
Whether or not this object is visible to a specific client |
Network |
Hides a list of Network |
Network |
Hides the Network |
Network |
Makes a list of previously hidden Network |
Network |
Makes the previously hidden Network |
Remove |
Removes all ownership of an object from any client. Can only be called from server |
Spawn(bool) | Spawns this Network |
Spawn |
Spawns a Network |
Spawn |
Spawns a Network |
Try |
Removes the parent of the NetworkObject's transform |
Try |
Set the parent of the NetworkObject transform. |
Try |
Set the parent of the NetworkObject transform. |
Try |
Set the parent of the NetworkObject transform. |
World |
Returns the last known cached WorldPositionStays value for this NetworkObject |