Created
November 18, 2019 05:44
-
-
Save Badgerdox/b50257d55279e193f7d330d909fd08f8 to your computer and use it in GitHub Desktop.
CreatedAssets #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CreatedAssets : MonoBehaviour | |
{ | |
[SerializeField] private string _label; | |
private List<GameObject> Assets { get; } = new List<GameObject>(); | |
private void Start() | |
{ | |
CreateAndWaitUntilCompleted(); | |
} | |
private async Task CreateAndWaitUntilCompleted() | |
{ | |
await CreateAddressablesLoader.ByAddressWithLabel(_label, Assets); | |
foreach (var asset in Assets) | |
{ | |
//OBJS LOADED PERFORM ADDITIONAL ACTIONS | |
Debug.Log(asset.name); | |
} | |
await Task.Delay(TimeSpan.FromSeconds(2)); | |
ClearAssets(Assets); | |
} | |
private void ClearAssets(List<GameObject> gos) | |
{ | |
foreach (var go in gos) | |
{ | |
Debug.Log("Released: " + go.name); | |
Addressables.Release(go); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment