Realtime
Realtime
Static Properties
IReadOnlyCollection<Realtime> instances { get; }
All of the Realtime instances currently loaded in scenes.
Static Methods
GameObject Instantiate(string prefabName, InstantiateOptions? options)
Instantiates a realtime prefab in the scene on all clients.
The fully instantiated game object. All RealtimeViews and RealtimeComponents, along with their models will be initialized and ready for use immediately.
GameObject Instantiate(string prefabName, Vector3 position, Quaternion rotation, InstantiateOptions? options)
Instantiates a realtime prefab in the scene on all clients.
The fully instantiated game object. All RealtimeViews and RealtimeComponents, along with their models will be initialized and ready for use immediately.
void Destroy(GameObject gameObject)
Destroys a realtime prefab on all clients.
This method must be used instead of GameObject.Destroy(). It can only be used with GameObjects that were instantiated with Realtime.Instantiate().
void Destroy(RealtimeView realtimeView)
Destroys a realtime prefab on all clients.
This method must be used instead of GameObject.Destroy(). It can only be used with GameObjects that were instantiated with Realtime.Instantiate().
Events
event RealtimeEvent didConnectToRoom
An event that is fired when Realtime is connected to a room and all realtime prefabs and realtime views in the scene have been successfully connected to the datastore.
event RealtimeEvent didDisconnectFromRoom
An event that is fired when Realtime is disconnected from a room.
event RealtimeDisconnectEvent didDisconnectFromRoomWithEvent
An event that is fired when Realtime is disconnected from a room. Provides detailed information about the disconnect.
Properties
JoinRoomOnStartOptions joinRoomOnStartOptions { get; }
The options that configure if and how [Normal.Realtime.Realtime](Normal.Realtime#realtime) will connect on Start().
These settings can only be configured in the editor inspector. If you'd like more control over joining rooms at runtime, disable "Join Room On Start" and use the or methods instead.
NormcoreAppSettings normcoreAppSettings { get; set; }
The app settings object reference used when Realtime connects. Changing this while the Realtime instance is connected will not have any effect until the next time it connects.
Room room { get; set; }
bool connecting { get; }
True if this Realtime instance is in the process of connecting or initializing its views.
bool connected { get; }
True if this Realtime instance is connected and its views are initialized.
bool disconnected { get; }
True if this Realtime instance is not connected or in an error state.
int clientID { get; }
The local clientID of this Realtime instance.
string roomName { get; }
The name of the room.
double roomTime { get; }
The server time on this frame in unix epoch time format (seconds since 00:00:00 UTC on January 1, 1970).
This value can be used to drive animations and is backed by a monotonic clock with sub-millisecond precision. This value has latency from the server removed.
DateTime? roomDateTime { get; }
The server date and time on this frame (UTC).
This value can be used to drive day/night cycles, for example. It is directly derived from . Will be null when the room is not yet in the state.
float ping { get; }
The local client's last known ping with the server in milliseconds.
RegionMetadata? region { get; }
The region metadata for the current room server.
Methods
Task<GetRegionsListResponse> GetRegionsListAsync(GetRegionsListOptions options = null, CancellationToken cancellationToken = null)
void Connect(string roomName, RealtimeModel roomModel)
Connect to a room.
void Connect(string roomName, ConnectOptions connectOptions = null)
Connect to a room.
void ConnectDirectlyToQuickmatchRoom(string roomGroupName, string roomCode, ConnectOptions connectOptions = null)
void ConnectToNextAvailableQuickmatchRoom(string roomGroupName, int capacity, ConnectOptions connectOptions = null)
void Disconnect()
Disconnect from a room.