initial commit
This commit is contained in:
parent
6715289efe
commit
788c3389af
37645 changed files with 2526849 additions and 80 deletions
|
|
@ -0,0 +1,34 @@
|
|||
namespace AddressableAssets.DocExampleCode
|
||||
{
|
||||
#region doc_Load
|
||||
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AddressableAssets;
|
||||
using UnityEngine.ResourceManagement.AsyncOperations;
|
||||
|
||||
internal class LoadAddress : MonoBehaviour
|
||||
{
|
||||
public string key;
|
||||
AsyncOperationHandle<GameObject> opHandle;
|
||||
|
||||
public IEnumerator Start()
|
||||
{
|
||||
opHandle = Addressables.LoadAssetAsync<GameObject>(key);
|
||||
yield return opHandle;
|
||||
|
||||
if (opHandle.Status == AsyncOperationStatus.Succeeded)
|
||||
{
|
||||
GameObject obj = opHandle.Result;
|
||||
Instantiate(obj, transform);
|
||||
}
|
||||
}
|
||||
|
||||
void OnDestroy()
|
||||
{
|
||||
Addressables.Release(opHandle);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue