I am creating a puzzle game. I’d like to have it ship with a few themes that it can choose between at the main menu. A theme would consist of UX skins for the puzzle, this includes some behaviors, music, art, effects and so on.
In the future, I would like to make more skins available for in game purchase.
How would I go about architecting something like this? How do they get packaged so that they can just drop in and be identified by the UI? I imagine that reflection is involved but Unity is such a different beast I want to make sure I don’t make some faulty assumptions and waste a bunch of time.
Reflection won’t really be necessary. If you want to change colors and images and maybe the layout then you can store that information in ScriptableObjects (or some other file like json, xml, txt, csv, whatever you like).
You can change the images in unity pretty easily on any component (SpriteRenderer) by changing the “sprite” property.
Now the question is how to load the images. Unitys recommended way are Addressables. They allow you to load them at runtime, either from a local source or download a remote version.
A simpler way without using ScriptableObjects or Addressables would be to already have all of the UI with every version created, the enable the one the user picks and disable the others. You could even put them in different scenes to load/unload them so they don’t take up memory and are easier to edit for the UI designer.
Thanks, that is sort of my question. There’s probably a few ways to do this. I considered something like that. Let’s say that in the future I want there to be in app purchases or even just updates that include more skins. How do those get delivered in a way that is discoverable? Apologies if the question seems obvious. I’m just starting out but I want to make sure I architect this right as much as possible up front.
As chubshobe said you can put everything in scenes too.
The easiest (and also worst / least flexible) is to reference everything directly from your scene.
You can also put your sprites into the Resources folder and load them from there (though unloading is difficult and it’s not recommended). But it’s super convenient for just a few items.
If you want to load in items on the fly from a remote source then Addressables are the way to go.
And Unity recommends Addressables for any scenario. I think Addressables is the one system that’s supposed to replace all other means of loading content.