Repository navigation
API: Session Info
Lyraedan edited this page Sep 24, 2026
·
3 revisions
SessionInfoAPI exposes the current multiplayer session state. All members are safe to read when ONI Together is absent (they return false / 0).
Namespaces:
-
ONI_Together_API→SessionInfoAPI
| Member | Type | Description |
|---|---|---|
InSession |
bool |
True while a multiplayer session is active |
IsHost |
bool |
True if the local player is the host |
IsClient |
bool |
True if the local player is a client |
LocalUserID |
ulong |
Local player's user id |
HostUserID |
ulong |
Host's user id |
MultiplayerModPresent |
bool |
Forwarded from MP_Mod_Info
|
| Method | Returns | Description |
|---|---|---|
TryGetPlayerCursorPos(ulong playerId, out Vector3 cursorPos) |
bool |
World position of a player's cursor |
TryGetPlayerColor(ulong playerId, out Color color) |
bool |
Assigned colour of a player |
using ONI_Together_API;
using UnityEngine;
if (SessionInfoAPI.InSession)
{
bool isHost = SessionInfoAPI.IsHost;
bool isClient = SessionInfoAPI.IsClient;
ulong me = SessionInfoAPI.LocalUserID;
ulong host = SessionInfoAPI.HostUserID;
if (SessionInfoAPI.TryGetPlayerCursorPos(host, out Vector3 hostCursor))
{
// hostCursor is valid
}
if (SessionInfoAPI.TryGetPlayerColor(host, out Color hostColor))
{
// hostColor is valid
}
}Mod development environment setup
ONI Together API