void Start()
{
Addressables.LoadAssetAsync<GameObject>("Assets/Res/Cube.prefab").Completed += ObjectLoadDone;
}
private void ObjectLoadDone(AsyncOperationHandle<GameObject> obj)
{
if (obj.Status == AsyncOperationStatus.Succeeded)
{
GameObject loadedObject = obj.Result;
Debug.Log("Successfully loaded object.");
instantiatedObject = Instantiate(loadedObject);
Debug.Log("Successfully instantiated object.");
if (accessoryObjectToLoad != null)
{
accessoryObjectToLoad.InstantiateAsync().Completed += op =>
{
if (op.Status == AsyncOperationStatus.Succeeded)
{
instantiatedAccessoryObject = op.Result;
Debug.Log("Successfully loaded and instantiated accessory object.");
}
};
}
}
}
Unity客户端开发_Address寻址系统
最新推荐文章于 2024-08-26 15:49:18 发布