Now with the new update [0.7.4] we don’t have Addressables.ReleaseInstance(GameObject, Float) overload, instead we have Addressables.ReleaseInstance(AsyncOperationHandle);
How would it be an equivalent for Addressables.ReleaseInstance(GameObject, Float)? At the moment the solution for me it’s a Coroutine, but i don’t really wan’t to use a coroutine.
Before
Addressables.ReleaseInstance(gameObject, 0.5f);
My solution at the moment
private IEnumerator Destroy(GameObject go, float time)
{
yield return new WaitForSeconds(time);
Addressables.ReleaseInstance(go);
}
StartCoroutine(Destroy(gameObject, 0.5f))
We don’t either! Here’s the problem. We initially had this because the engine does have a Destroy
that takes a delay. The problem is we can’t actually use that. If you said to destroy a tank in 10 minutes, and we just called the engine’s destroy with delay, we’d also have to do our own delay to unload anything with a ref count of 0. If we unloaded right away, things would break.
There are several ways to delay things in C#, a coroutine being one of the main ones. If we provide a delay interface, we have to choose which method we think is best (coroutine? task? other?), and do that. If we don’t provide the interface, you do have to implement it yourself, but it gives you the ability to implement it whichever way is best for your game.