RaptorLogicHosts
Decides which host runs Logic in a Play session.
| Namespace | Assembly | Kind | Stability |
|---|---|---|---|
Raptor.Logic | Raptor.Logic.Runtime | class | preview, since 0.1.0 |
RAPTOR's built-in local host runs Logic for one player on one machine. A project with its own host, such as a networked one, calls Claim before the first scene finishes loading, from a [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] method or an Awake in that scene. The local host then does not start.
A claim lasts one Play session. It is cleared at SubsystemRegistration at the start of every session, including when Play is entered without a domain reload, so claim again each session. This works in the editor and in built players.
public static class RaptorLogicHostsProperties
IsClaimed
public static bool IsClaimed { get; }True once a host has claimed Logic for this session. Resets to false at the start of every Play session.
Owner
public static string Owner { get; }The claiming host's name, or null while unclaimed. Resets to null at the start of every Play session.
Methods
Claim
public static bool Claim(string ownerName)Claims Logic for the host named ownerName. The first claim in a session wins. Claiming again with the same name returns true. A different name logs a warning and returns false. Throws ArgumentException if ownerName is null, empty or white space.
| Parameter | Type | Description |
|---|---|---|
ownerName | string | Your host's name, shown in the warning when another host claims too. |
Returns: True when your host owns Logic for this session.