Create any Addressable Asset Simple, Fast, Understandable!
Require assistance? Need to talk some game dev.? Looking for feedback? Join the discussion on Discord
If you don’t check out any of the series ‘ other tutorials, this is the one you need! I’ll show you how to create addressable assets while automatically waiting for their creation to complete. After waiting for the asset to finish being created it will be added to a collection. The newly created asset will be available for additional operations within milliseconds. Copy this code snippet into your project making any appropriate edits for your use case.
Another cool feature of Addressables is that the methods we use are asynchronous. It gives the program the ability to wait for the assets to completely instantiated before attempting use.
An asset’s name is a convenient key used to bring up the assets build path, or IResourceLocation. It is very simple to find and rename.
Labels are a handy key for defining groups of like assets Check out this guide for more information about tags as well as other tips and tricks.
All that remains to be done is to call the creation method and watch the resources explode into being. If you followed the previous tutorial, we will put our statement the start method of CreatedAssets.cs.
Remember to set your label and Asset Name within the editor to avoid null reference errors.
Back within the Unity editor go ahead and press that play button to test your asset creation. Look out for a message to display in the console stating the name of created objects, this illustrates the objects being ready to use.
Way to go getting through this training! The next tutorial will explore how to sort assets instantly with MergeMode.
Find this post helpful? Please feel free to share it wherever you think it would encourage others.
Anything you’d like more details about? Leave a comment and I’ll respond as thoroughly as possible. Looking for a subject that wasn’t covered, post a suggestion and I’ll get busy filming and creating a write-up.