NikosAssets.Instantiation 0.1.0
Loading...
Searching...
No Matches
NikosAssets.Instantiation.BaseInstantiationData< TObject > Class Template Referenceabstract

A wrapper class to handle the instantiation implementation as a serializable object that can be configured as a field in the Unity inspector. More...

Public Member Functions

void Dispose ()
async Task< TObject > CreateInstanceAsync (Transform parent=null, bool worldPositionStays=false)
async Task< TObject > CreateInstanceAsync (Vector3 position, Quaternion rotation, Transform parent=null)
async Task< TObject > LoadAssetReferenceAsync ()
 Loads the Object to clone and caches it in the CachedAssetReference
async Task UnloadAssetReference ()
 Unloads the CachedAssetReference when using addressables. For convenience you can also just call Dispose().

Public Attributes

bool loadAssetReference
 set to true if you want to assign an assetReference and load it
AssetReference assetReference
TObject objectReference

Protected Attributes

CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource()

Properties

TObject CachedAssetReference [get, set]
 Either set a cached asset yourself or call and await LoadAssetReferenceAsync() to initialize this property. By default, this cached asset reference will be used for Instantiation and it is even recommended you use it yourself to avoid overhead.

Detailed Description

A wrapper class to handle the instantiation implementation as a serializable object that can be configured as a field in the Unity inspector.

Template Parameters
TObject
Type Constraints
TObject :Object 

Member Function Documentation

◆ CreateInstanceAsync() [1/2]

async Task< TObject > NikosAssets.Instantiation.BaseInstantiationData< TObject >.CreateInstanceAsync ( Transform parent = null,
bool worldPositionStays = false )

◆ CreateInstanceAsync() [2/2]

async Task< TObject > NikosAssets.Instantiation.BaseInstantiationData< TObject >.CreateInstanceAsync ( Vector3 position,
Quaternion rotation,
Transform parent = null )

◆ LoadAssetReferenceAsync()

async Task< TObject > NikosAssets.Instantiation.BaseInstantiationData< TObject >.LoadAssetReferenceAsync ( )

Loads the Object to clone and caches it in the CachedAssetReference

Returns
The CachedAssetReference

Implements NikosAssets.Instantiation.IInstantiation< TObject >.

◆ UnloadAssetReference()

async Task NikosAssets.Instantiation.BaseInstantiationData< TObject >.UnloadAssetReference ( )

Unloads the CachedAssetReference when using addressables. For convenience you can also just call Dispose().

Returns

Implements NikosAssets.Instantiation.IInstantiation< TObject >.

Property Documentation

◆ CachedAssetReference

TObject NikosAssets.Instantiation.BaseInstantiationData< TObject >.CachedAssetReference
getset

Either set a cached asset yourself or call and await LoadAssetReferenceAsync() to initialize this property. By default, this cached asset reference will be used for Instantiation and it is even recommended you use it yourself to avoid overhead.

Implements NikosAssets.Instantiation.IInstantiation< TObject >.


The documentation for this class was generated from the following file:
  • BaseInstantiationData.cs