Infohazard.Core.Addressables 1.0.0
Infohazard Core Addressables Integration
Loading...
Searching...
No Matches
Infohazard.Core.Addressables.AddressableSpawnRefBase< T > Class Template Referenceabstract

Only used internally. More...

Classes

class  PropNames
 This is used to refer to the names of private fields in this class from a custom Editor. More...
 

Public Member Functions

 AddressableSpawnRefBase ()
 Default constructor (needed for Unity serialization). More...
 
 AddressableSpawnRefBase (AssetReferenceGameObject assetReference)
 Construct with a given asset reference. More...
 
override string ToString ()
 
virtual UniTask RetainAndWaitAsync ()
 Add a user to the AddressableSpawnRef, creating the AddressablePoolHandler if necessary. If not already loaded, the prefab will be loaded asynchronously. More...
 
virtual async UniTask WaitUntilLoadedAsync ()
 If the prefab is currently loading, wait until it is done asynchronously. More...
 
virtual void RetainAndWait ()
 Add a user to the AddressableSpawnRef, creating the AddressablePoolHandler if necessary. If not already loaded, the prefab will be loaded and block. More...
 
virtual void WaitUntilLoaded ()
 If the prefab is currently loading, wait until it is done synchronously. More...
 
virtual void Retain ()
 Add a user to the AddressableSpawnRef, creating the AddressablePoolHandler if necessary. More...
 
virtual void Release ()
 Remove a user from the AddressableSpawnRef, in turn releasing the IPoolHandler. More...
 
Spawn (in SpawnParams spawnParams=default)
 Spawn an instance of Prefab. The AddressableSpawnRef MUST be retained. More...
 

Protected Attributes

AssetReferenceGameObject _assetReference
 (Serialized) Reference to the addressable prefab to spawn. More...
 

Properties

AssetReferenceGameObject AssetReference [get]
 Reference to the addressable prefab to spawn. More...
 
bool IsValid [get]
 Whether there is a valid asset reference. More...
 
bool Loaded [get]
 Whether the referenced asset has been loaded successfully and the AddressableSpawnRef is retained at least once. More...
 
int RetainCount [get, private set]
 Number of users of the AddressableSpawnRef More...
 
Prefab [get]
 Prefab to be spawned, if it is loaded. More...
 

Detailed Description

Only used internally.

Similar to SpawnRef, but for spawning addressable prefabs.

Template Parameters
TThe type of object to be referenced.
Type Constraints
T :Object 

Constructor & Destructor Documentation

◆ AddressableSpawnRefBase() [1/2]

Default constructor (needed for Unity serialization).

◆ AddressableSpawnRefBase() [2/2]

Infohazard.Core.Addressables.AddressableSpawnRefBase< T >.AddressableSpawnRefBase ( AssetReferenceGameObject  assetReference)

Construct with a given asset reference.

Parameters
assetReferenceThe prefab to be spawned.

Member Function Documentation

◆ Release()

virtual void Infohazard.Core.Addressables.AddressableSpawnRefBase< T >.Release ( )
virtual

Remove a user from the AddressableSpawnRef, in turn releasing the IPoolHandler.

◆ Retain()

virtual void Infohazard.Core.Addressables.AddressableSpawnRefBase< T >.Retain ( )
virtual

Add a user to the AddressableSpawnRef, creating the AddressablePoolHandler if necessary.

Does not wait for the loading to finish.

◆ RetainAndWait()

virtual void Infohazard.Core.Addressables.AddressableSpawnRefBase< T >.RetainAndWait ( )
virtual

Add a user to the AddressableSpawnRef, creating the AddressablePoolHandler if necessary. If not already loaded, the prefab will be loaded and block.

◆ RetainAndWaitAsync()

virtual UniTask Infohazard.Core.Addressables.AddressableSpawnRefBase< T >.RetainAndWaitAsync ( )
virtual

Add a user to the AddressableSpawnRef, creating the AddressablePoolHandler if necessary. If not already loaded, the prefab will be loaded asynchronously.

If the prefab is already loaded, this will return synchronously.

◆ Spawn()

T Infohazard.Core.Addressables.AddressableSpawnRefBase< T >.Spawn ( in SpawnParams  spawnParams = default)

Spawn an instance of Prefab. The AddressableSpawnRef MUST be retained.

If the addressable has not yet finished loading, it will block until done. For this reason, you should Retain the AddressableSpawnRef well in advance of needing to spawn.

Parameters
spawnParamsAdditional spawn info.
Returns
The spawned object.

◆ ToString()

override string Infohazard.Core.Addressables.AddressableSpawnRefBase< T >.ToString ( )

◆ WaitUntilLoaded()

virtual void Infohazard.Core.Addressables.AddressableSpawnRefBase< T >.WaitUntilLoaded ( )
virtual

If the prefab is currently loading, wait until it is done synchronously.

This will not start loading the prefab if it is not already loading.

◆ WaitUntilLoadedAsync()

virtual async UniTask Infohazard.Core.Addressables.AddressableSpawnRefBase< T >.WaitUntilLoadedAsync ( )
virtual

If the prefab is currently loading, wait until it is done asynchronously.

This will not start loading the prefab if it is not already loading.

Member Data Documentation

◆ _assetReference

AssetReferenceGameObject Infohazard.Core.Addressables.AddressableSpawnRefBase< T >._assetReference
protected

(Serialized) Reference to the addressable prefab to spawn.

Property Documentation

◆ AssetReference

AssetReferenceGameObject Infohazard.Core.Addressables.AddressableSpawnRefBase< T >.AssetReference
get

Reference to the addressable prefab to spawn.

◆ IsValid

Whether there is a valid asset reference.

◆ Loaded

Whether the referenced asset has been loaded successfully and the AddressableSpawnRef is retained at least once.

◆ Prefab

Prefab to be spawned, if it is loaded.

◆ RetainCount

int Infohazard.Core.Addressables.AddressableSpawnRefBase< T >.RetainCount
getprivate set

Number of users of the AddressableSpawnRef


The documentation for this class was generated from the following file: