/// <summary>
 /// Release an instantiated object.
 /// </summary>
 /// <param name="obj">The object to release.</param>
 public void ReleaseInstance(GameObject obj)
 {
     Addressables.ReleaseInstance(obj);
 }
 /// <summary>
 /// Instantiate the referenced asset as type TObject.
 /// </summary>
 /// <typeparam name="TObject">The object type.</typeparam>
 /// <param name="parent">The parent of the instantiated object.</param>
 /// <param name="instantiateInWorldSpace">Option to retain world space when instantiated with a parent.</param>
 /// <returns></returns>
 public AsyncOperationHandle <GameObject> Instantiate(Transform parent = null, bool instantiateInWorldSpace = false)
 {
     return(Addressables.Instantiate(RuntimeKey, parent, instantiateInWorldSpace, true));
 }
示例#3
0
 /// <summary>
 /// Unloads the reference as a scene.
 /// </summary>
 /// <returns>The operation handle for the scene load.</returns>
 public virtual AsyncOperationHandle <SceneInstance> UnLoadScene()
 {
     return(Addressables.UnloadSceneAsync(m_Operation, true));
 }
 /// <summary>
 /// Instantiate the referenced asset as type TObject.
 /// </summary>
 /// <param name="position">Position of the instantiated object.</param>
 /// <param name="rotation">Rotation of the instantiated object.</param>
 /// <param name="parent">The parent of the instantiated object.</param>
 /// <returns></returns>
 public AsyncOperationHandle <GameObject> Instantiate(Vector3 position, Quaternion rotation, Transform parent = null)
 {
     return(Addressables.Instantiate(RuntimeKey, position, rotation, parent, true));
 }
示例#5
0
 static AsyncOperationHandle <T> CreateFailedOperation <T>()
 {
     //this needs to be set in order for ResourceManager.ExceptionHandler to get hooked up to AddressablesImpl.LogException.
     Addressables.InitializeAsync();
     return(Addressables.ResourceManager.CreateCompletedOperation(default(T), new Exception("Attempting to load an asset reference that has no asset assigned to it.").Message));
 }