Skip to main content

LoadAssetAsync

Description

Asynchronously load a single asset from our package through the project name, and hope to load the asset name.

Return

caution

This api is loading Prefab from disk into memory. It is not instantiating the Prefab into the game scene.

TypeDescription
ObjectYour asset of T type

Parameters

ParamTypeDescription
TTUnityObject Type
_projectNameStringyour project name
_wannaLoadedAssetNameStringyou wanna load asset name

Method

public async Task<T> LoadAssetAsync<T>(string _projectName, string _wannaLoadedAssetName)

Example

internal static API api = new API(nameof(TestAPI));

public async void OnLoad()
{
var tmp_UICanvasPrefab = await api.LoadAssetAsync<GameObject>("UI_CANVAS_NAME");
stackARCanvasGO = Object.Instantiate(tmp_UICanvasPrefab);
}