Class PortalRegistry
The live portals in every loaded scene, by Unity scene handle and authored portal index.
public static class PortalRegistry
- Inheritance
-
PortalRegistry
- Inherited Members
Remarks
Keyed by handle, like WaypointRegistry, because instances load several copies
of one scene into one process. Portals register in OnEnable on every peer — a
SceneTeleporter portal has no NetworkObject and so no server start to hang it
on — and the server uses the registry to know which scenes' world rows to read and which
portals to report to a player entering a scene.
Methods
AnyInScene(string)
Whether any live portal stands in a scene with this name, in any instance.
public static bool AnyInScene(string sceneName)
Parameters
sceneNamestring
Returns
Clear()
Drops every registration. Tests.
public static void Clear()
Collect(SceneHandle, List<PortalActivation>)
Appends the live portals of one scene instance, sorted by index.
public static void Collect(SceneHandle sceneHandle, List<PortalActivation> results)
Parameters
sceneHandleSceneHandleresultsList<PortalActivation>
CollectSceneNames(HashSet<string>)
Appends the names of every scene with a live portal, each once.
public static void CollectSceneNames(HashSet<string> results)
Parameters
Register(PortalActivation)
Adds a portal. A duplicate index in one scene is refused and reported: two portals sharing an index would open together.
public static bool Register(PortalActivation portal)
Parameters
portalPortalActivation
Returns
TryGet(SceneHandle, int, out PortalActivation)
Finds a live portal by scene handle and index.
public static bool TryGet(SceneHandle sceneHandle, int portalIndex, out PortalActivation portal)
Parameters
sceneHandleSceneHandleportalIndexintportalPortalActivation
Returns
Unregister(PortalActivation)
Removes a portal, if it is the one registered under its index.
public static void Unregister(PortalActivation portal)
Parameters
portalPortalActivation
Events
Registered
A portal registered. The server reads its scene's world rows if it has not.
public static event Action<PortalActivation> Registered