So I have dialogue system (prefab) that is in every scenes. When a character is speaking, we see a picture of it. There is a lot of characters and each characters have many images depending of the state of the game. So on the code side, it looks like something like this:
aCharacterImageWithThisState.SetActive(true)
Now, the prefab has a lot of game objects with UnityEngine.UI.Image. In fact, it is 1 game object with an Image component per character per state (so a lot of game objects) since every image doesn’t necessarily have the same size and position.
I was wondering how I could optimize this system since I’m adding multiple different character images every day. I’m scared that in the long term this prefab takes a lot of memory in game with all his hidden images. I thought of using the Resource.Load
but I read at some places that it was risky to use it.
What can I do to optimize this? Thanks