Skip to main content

RealtimeView

RealtimeView

A component that manages a set of RealtimeComponents on a game object.

Static Fields

ExecutionOrder

public int ExecutionOrder

Events

ownerIDSelfDidChange

event Action<RealtimeView, int> ownerIDSelfDidChange

Dispatched when the ownerIDSelf value changes.

didReplaceAllComponentModels

event Action<RealtimeView> didReplaceAllComponentModels

Dispatched after all of the components of this view have been initialized with a new Realtime model.

Fields

sceneViewWillRegisterWithRealtime

public SceneViewWillRegisterDelegate sceneViewWillRegisterWithRealtime

Called when a scene view is about to register with Realtime. Use this to return a different Realtime instance than whatever was assigned in the scene, like on scene views that were additively loaded. This should be set during Awake, and is called during Start.

Properties

viewUUID

string viewUUID { get; }

The UUID of a RealtimeView instance. This is used to associate scene objects across clients and sessions. For scene objects, it is pregenerated by the editor. For prefab objects, it is null. Any changes to it will break persistence.

isChildView

bool isChildView { get; }

True if the view is a child view.

isRootView

bool isRootView { get; }

True if the view is a root view (scene or prefab).

isPrefabView

bool isPrefabView { get; }

True if the view is part of a prefab view hierarchy.

isSceneView

bool isSceneView { get; }

True if the view is part of a scene view hierarchy.

isRootSceneView

bool isRootSceneView { get; }

True if the view is a root scene view.

isRootPrefabView

bool isRootPrefabView { get; }

True if the view is a root prefab view.

realtimeView

RealtimeView realtimeView { get; }

The RealtimeView that owns this component. Accessing this property before Start is unreliable.

realtime

Realtime realtime { get; }

The Realtime instance that is managing this component. On prefab views, this property is available after Awake. On scene views or their children, this is not available until Start.

room

Room room { get; }

The current room of the Realtime instance that is managing this component. This might be null if the Realtime instance hasn't connected yet. Accessing this property before Start is unreliable.

ownerIDSelf

int ownerIDSelf { get; }

The client ID of the component owner.

ownerIDInHierarchy

int ownerIDInHierarchy { get; }

The client ID of the component's hierarchy owner (the root owner of the component).

isUnownedSelf

bool isUnownedSelf { get; }

True if the component is not owned by any client.

isUnownedInHierarchy

bool isUnownedInHierarchy { get; }

True if the component and all of its parent views are not owned by any client.

isOwnedLocallySelf

bool isOwnedLocallySelf { get; }

True if the component is owned by the local client.

isOwnedLocallyInHierarchy

bool isOwnedLocallyInHierarchy { get; }

True if the component and all of its parent views are owned by the local client.

isOwnedRemotelySelf

bool isOwnedRemotelySelf { get; }

True if the component is owned by a remote client.

isOwnedRemotelyInHierarchy

bool isOwnedRemotelyInHierarchy { get; }

True if this component and all of its parent views are owned by a remote client.

preventOwnershipTakeover

bool preventOwnershipTakeover { get; set; }

If true, the model owner must clear ownership before another client can request it.

destroyWhenLastClientLeaves

bool destroyWhenLastClientLeaves { get; set; }

If true, the model is destroyed when the last client in the room leaves.

destroyWhenOwnerLeaves

bool destroyWhenOwnerLeaves { get; set; }

If true, the model is destroyed when the owner of the model leaves the room.

Methods

GetRootView

RealtimeView GetRootView()

Returns the root view of this view, or this view if it is the root.

GetParentView

RealtimeView GetParentView()

Returns the parent view of this view, or null if this is the root view.

OnBeforeSerialize

void OnBeforeSerialize()

OnAfterDeserialize

void OnAfterDeserialize()

RequestOwnership

void RequestOwnership()

Request ownership of the component.

SetOwnership

void SetOwnership(int clientID)

Set ownership of the component.

ClearOwnership

void ClearOwnership()

Clear ownership of the component.

RequestOwnershipOfSelfAndChildren

void RequestOwnershipOfSelfAndChildren()