Photon Fusion 2.0.3

Protected Member Functions | Static Protected Member Functions | Properties | List of all members
FusionGlobalScriptableObject< T > Class Template Reference

A base class for ScriptableObjects that are meant to be globally accessible, at edit-time and runtime. The way such objects are loaded is driven by usages of FusionGlobalScriptableObjectSourceAttribute attributes. More...

Inherits FusionScriptableObject, and FusionGlobalScriptableObject.

Protected Member Functions

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

Static Protected Member Functions

static bool TryGetGlobalInternal (out T global)
 Loads or returns the current global instance. Returns null if loading an instance failed. More...
 
static bool UnloadGlobalInternal ()
 Unloads the global instance if it is loaded. More...
 

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. More...
 
bool IsGlobal [get]
 Is this instance a global instance. More...
 
static bool IsGlobalLoadedInternal [get]
 Returns true if a global instance is loaded. Compared to GlobalInternal, it does not attempt to load an instance. More...
 

Detailed Description

A base class for ScriptableObjects that are meant to be globally accessible, at edit-time and runtime. The way such objects are loaded is driven by usages of FusionGlobalScriptableObjectSourceAttribute attributes.

Type Constraints
T :FusionGlobalScriptableObject<T> 

Member Function Documentation

◆ OnDisable()

virtual void OnDisable ( )
protectedvirtual

If the current instance is global, unsets IsGlobal and calls OnUnloadedAsGlobal

Reimplemented in NetworkProjectConfigAsset.

◆ OnLoadedAsGlobal()

virtual void OnLoadedAsGlobal ( )
protectedvirtual

Invoked when the instance is loaded as global.

◆ OnUnloadedAsGlobal()

virtual void OnUnloadedAsGlobal ( bool  destroyed)
protectedvirtual

Invoked when the instance is unloaded as global.

Parameters
destroyed

◆ TryGetGlobalInternal()

static bool TryGetGlobalInternal ( out T  global)
staticprotected

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

Parameters
global
Returns

◆ UnloadGlobalInternal()

static 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

◆ IsGlobal

bool IsGlobal
get

Is this instance a global instance.

◆ IsGlobalLoadedInternal

bool IsGlobalLoadedInternal
staticgetprotected

Returns true if a global instance is loaded. Compared to GlobalInternal, it does not attempt to load an instance.