Class InstanceFinder
Used to globally get information from the first found instance of NetworkManager.
Inheritance
Inherited Members
Namespace: FishNet
Assembly: FishNet.Runtime.dll
Syntax
public static class InstanceFinder
Properties
ClientManager
Returns the first instance of ClientManager.
Declaration
public static ClientManager ClientManager { get; }
Property Value
Type | Description |
---|---|
ClientManager |
IsClient
Declaration
[Obsolete("Use IsClientStarted. Note the difference between IsClientInitialized and IsClientStarted.")]
public static bool IsClient { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsClientOnly
Declaration
[Obsolete("Use IsClientOnlyStarted. Note the difference between IsClientOnlyInitialized and IsClientOnlyStarted.")]
public static bool IsClientOnly { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsClientOnlyStarted
True if only the client is started and authenticated.
Declaration
public static bool IsClientOnlyStarted { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsClientStarted
True if the client is started and authenticated.
Declaration
public static bool IsClientStarted { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsHost
Declaration
[Obsolete("Use IsHostStarted. Note the difference between IsHostInitialized and IsHostStarted.")]
public static bool IsHost { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsHostStarted
True if client and server are started.
Declaration
public static bool IsHostStarted { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsOffline
True if client nor server are started.
Declaration
public static bool IsOffline { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsServer
Declaration
[Obsolete("Use IsServerStarted. Note the difference between IsServerInitialized and IsServerStarted.")]
public static bool IsServer { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsServerOnly
Declaration
[Obsolete("Use IsServerOnlyStarted. Note the difference between IsServerOnlyInitialized and IsServerOnlyStarted.")]
public static bool IsServerOnly { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsServerOnlyStarted
True if only the server is started.
Declaration
public static bool IsServerOnlyStarted { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsServerStarted
True if the server is active.
Declaration
public static bool IsServerStarted { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
NetworkManager
Returns the first found NetworkManager instance.
Declaration
public static NetworkManager NetworkManager { get; }
Property Value
Type | Description |
---|---|
NetworkManager |
PredictionManager
Returns the first instance of PredictionManager.
Declaration
public static PredictionManager PredictionManager { get; }
Property Value
Type | Description |
---|---|
PredictionManager |
RollbackManager
Returns the first instance of RollbackManager.
Declaration
public static RollbackManager RollbackManager { get; }
Property Value
Type | Description |
---|---|
RollbackManager |
SceneManager
Returns the first instance of SceneManager.
Declaration
public static SceneManager SceneManager { get; }
Property Value
Type | Description |
---|---|
SceneManager |
ServerManager
Returns the first instance of ServerManager.
Declaration
public static ServerManager ServerManager { get; }
Property Value
Type | Description |
---|---|
ServerManager |
StatisticsManager
Returns the first instance of StatisticsManager.
Declaration
public static StatisticsManager StatisticsManager { get; }
Property Value
Type | Description |
---|---|
StatisticsManager |
TimeManager
Returns the first instance of TimeManager.
Declaration
public static TimeManager TimeManager { get; }
Property Value
Type | Description |
---|---|
TimeManager |
TransportManager
Returns the first instance of TransportManager.
Declaration
public static TransportManager TransportManager { get; }
Property Value
Type | Description |
---|---|
TransportManager |
Methods
GetInstance<T>()
Returns class of type if found within CodegenBase classes.
Declaration
public static T GetInstance<T>()
where T : Component
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
HasInstance<T>()
Returns if class of type is registered with the NetworkManager.
Declaration
public static bool HasInstance<T>()
where T : Component
Returns
Type | Description |
---|---|
System.Boolean |
Type Parameters
Name | Description |
---|---|
T | Type to check for. |
RegisterInstance<T>(T, Boolean)
Registers a new component to this NetworkManager.
Declaration
public static void RegisterInstance<T>(T component, bool replace = true)
where T : Component
Parameters
Type | Name | Description |
---|---|---|
T | component | Reference of the component being registered. |
System.Boolean | replace | True to replace existing references. |
Type Parameters
Name | Description |
---|---|
T | Type to register. |
RegisterInvokeOnInstance<T>(Action<Component>)
Registers to invoke an action when a specified component becomes registered. Action will invoke immediately if already registered.
Declaration
public static void RegisterInvokeOnInstance<T>(Action<Component> handler)
where T : Component
Parameters
Type | Name | Description |
---|---|---|
System.Action<UnityEngine.Component> | handler | Action to invoke. |
Type Parameters
Name | Description |
---|---|
T | Component type. |
TryGetInstance<T>(out T)
Returns class of type from registered instances.
Declaration
public static bool TryGetInstance<T>(out T component)
where T : Component
Parameters
Type | Name | Description |
---|---|---|
T | component | Outputted component. |
Returns
Type | Description |
---|---|
System.Boolean | True if was able to get instance. |
Type Parameters
Name | Description |
---|---|
T | Type to get. |
TryRegisterInstance<T>(T)
Tries to registers a new component to this NetworkManager. This will not register the instance if another already exists.
Declaration
public static bool TryRegisterInstance<T>(T component)
where T : Component
Parameters
Type | Name | Description |
---|---|---|
T | component | Reference of the component being registered. |
Returns
Type | Description |
---|---|
System.Boolean | True if was able to register, false if an instance is already registered. |
Type Parameters
Name | Description |
---|---|
T | Type to register. |
UnregisterInstance<T>()
Unregisters a component from this NetworkManager.
Declaration
public static void UnregisterInstance<T>()
where T : Component
Type Parameters
Name | Description |
---|---|
T | Type to unregister. |
UnregisterInvokeOnInstance<T>(Action<Component>)
Unrgisters to invoke an action when a specified component becomes registered. Action will invoke immediately if already registered.
Declaration
public static void UnregisterInvokeOnInstance<T>(Action<Component> handler)
where T : Component
Parameters
Type | Name | Description |
---|---|---|
System.Action<UnityEngine.Component> | handler | Action to invoke. |
Type Parameters
Name | Description |
---|---|
T | Component type. |