Photon Fusion 2.1.1

FusionGlobalScriptableObject< T > Class Template Referenceabstract

More...

Inherits FusionGlobalScriptableObject.

Inherited by NetworkProjectConfigAsset.

Protected Member Functions

virtual void OnDisable ()
 If the current instance is global, unsets IsGlobal and calls OnUnloadedAsGlobal.
virtual void OnLoadedAsGlobal ()
 Invoked when the instance is loaded as global.
virtual void OnUnloadedAsGlobal (bool destroyed)
 Invoked when the instance is unloaded as global.

Static Protected Member Functions

static async System.Threading.Tasks.Task< T > GetGlobalAsyncInternal ()
 Loads or returns the current global instance asynchronously. Returns null if loading an instance failed.
static bool TryGetGlobalInternal (out T global)
 Loads or returns the current global instance. Returns null if loading an instance failed.
static bool UnloadGlobalInternal ()
 Unloads the global instance if it is loaded.

Properties

static T GlobalInternal [get, set]
 A singleton instance-like property. Loads or returns the current global instance. Derived classes can package it in a property with a different name. Throws if loading an instance failed.
bool IsGlobal [get]
 Is this instance a global instance.
static bool IsGlobalLoadedInternal [get]
 Returns true if a global instance is loaded. Compared to GlobalInternal, it does not attempt to load an instance.

Additional Inherited Members

Static Public Member Functions inherited from FusionGlobalScriptableObject
static void ClearTypesFailedToLoad ()
 Use to clear internal list marking specific type as unable to load. Types might be unable to load during bootstrap, so cleaning the list in some static initializer is a good way to ensure things can recover.

Detailed Description

Type Constraints
T :FusionGlobalScriptableObject<T> 

Member Function Documentation

◆ GetGlobalAsyncInternal()

async System.Threading.Tasks.Task< T > GetGlobalAsyncInternal ( )
staticprotected

Loads or returns the current global instance asynchronously. Returns null if loading an instance failed.

Returns

◆ OnUnloadedAsGlobal()

virtual void OnUnloadedAsGlobal ( bool destroyed)
protectedvirtual

Invoked when the instance is unloaded as global.

Parameters
destroyed

◆ TryGetGlobalInternal()

bool TryGetGlobalInternal ( out T global)
staticprotected

Loads or returns the current global instance. Returns null if loading an instance failed.

Parameters
global
Returns

◆ UnloadGlobalInternal()

bool UnloadGlobalInternal ( )
staticprotected

Unloads the global instance if it is loaded.

Returns
true if an instance was unloaded

Property Documentation

◆ GlobalInternal

T GlobalInternal
staticgetsetprotected

A singleton instance-like property. Loads or returns the current global instance. Derived classes can package it in a property with a different name. Throws if loading an instance failed.

Exceptions
InvalidOperationException