Migration from Resources to Addressables (Offline/embeded)

Hi there,

In my game using resources i have following structure

Script > Embeded SharedClass Applied to All CellPrefabs

Resources>Theme 1 > CellPrefab
Resources>Theme 2 > CellPrefab
Resources>Theme 3 > CellPrefab

As you can see, only the theme folder name changes, but rest of the inner data use exact same naming convention.

Now on runtime when user selects a theme i Resources.Load (“themes{1}/CellPrefab”), and then Instantiate that cell multiple time, destroy it and load next

How can i replicate the same behavoir with Addressables? For example how do i
1- load
2- then instantiate same cellprefab multiple times
3- then unload everything related to selected theme

And ideally i can “build” those theme folders and retrieve them from dropbox or something?
Thanks

NOW what i have learned so far

Change Theme folders (resources) to “Groups” in Addressables

1- use Resources.LoadAssetAsync, and then store the reference
2- simply Instantiate as usual
3- simply GameObject.Destroy as usuall and then Resources.Release (I’m not so sure here, if this is right memory management)

And related to “building” and loading those builds from network, will embeded C# class attached to those cell prefabs cause any issues on iOS etc?

Thanks

Hi!

Regarding your first issue, the Theme1, Theme2, etc. that can easily be done with the Address for each prefab. If you add an asset to a group it will get the full asset path as the initial Address. You can simplify the addresses, either let it do it automatically (right click on the entry in the group window) and select ‘Simplify Address’, but this will cut away the ‘path’ if the name is unique in the group. You can manually edit these addresses to represent them as you would call them in resources. So rename the address of each themed prefab as ‘Theme1/CellPrefab’, or write an editor script to do that for you. :slight_smile:

You can then call the usual Addressables methods like Addressables.LoadAssetAsync("Theme{0}/CellPrefab") and instantiate the returned result.

I’m not really following your second question, so I’m skipping to answer that one for now. :slight_smile:

1 Like

@LuGus-Jan Thank you for your reply,
In above approach, do i need to “build” anything? as ill be embedding these in the build anyway

2nd and 3rd question is more like how to manage memory, how to unload safely