Is there a way to replace loaded assets in the middle of play?

I’m considering a system in my game that will require me to change my player’s appearance at any point during normal play. My character is built with sprites so I’m talking about swapping out a series of spritesheets, and I’m creating animation with a fairly high number of frames, so they are somewhat large spritesheets.

So there are two (relatively minor) problems I am running into that I am hoping to be able to find a way around by controlling how I am loading these assets into memory.

First of all, keeping every spritesheet for every player animation multiplied across a yet unknown number of forms (probably three to five) is going to eat up quite a bit of memory. If I can keep those memory costs down it will expand my game’s availability for mobile devices.

If I had the ability to directly load and unload the needed sprites into memory when needed, it would help me keep those memory costs down. (I have no problem if there is a short pause while the new art is loaded.) But how can I directly manage how my game is loading and unloading assets into memory?

And then to expand on that, I wonder if it is possible to outright replace those sprites in the memory.
As it is right now, creating a new appearance for my character means I have to create a new animation controller, exactly like the old one, and re-create every animation, but now using the new sprites. That is a bit of work. And as I think of the problem abstractly, I think: If I could effectively overwrite the sprites in the memory with the new sprites, then I don’t need to make anything new. If there was some way to just have the game point at a different set of sprites, but use all of the same existing architecture, then I won’t need to re-create a whole new set of animations for every different outfit my player has.

I know the second one is a bit of a stretch, but I thought I would ask about it anyway.

Uhm, I not test it yet but I think this video can help you :

For your first minor problem I think you can remove from sprite render (equal null), and unload assets unused, but maybe this cost hardware time, I dont test this too. You can do a class manager for your scene and when you enter in camera view (or other situation you want load/unload) you can use a class manager to reload all this.

For your second question I was doing the same for some projects and I know how this is a painful. But after see this video I thinking to do that approach for next project and see how this fit. Well, in that showcase he just change sprites and animation controller is the same, I think this can solve your(our) problem for now and better thing: It’s a clean and nice workflow (and code).

As I think about it, some direct control over both loading and unloading would be very helpful to have. I wouldn’t mind taking the extra work to manually dictate what the game needs and doesn’t need if I could streamline my loading process to make sure everything can be accessed near-instantaneously.

Okay, the video is showing now (I don’t know why it wasn’t at first) and I watched it.
So there is an ability to unload assets on command, but it still runs into a logical error within the transition.

The method shown in the video is to load the new assets and then unload the old ones. This is going to require the system to have enough memory to have both loaded at the same time. Sure, it’s more efficient than loading three sets of assets at once, but I still just wonder if there is a better way.

Off the top of my head I’m thinking I could load the assets for a really small animation controller, basically just something that only has the animations for the transition itself (which could be something as simple as a puff of smoke, maybe,) and then unload the old whole-character set, then load the new whole-character set, and then switch from the transition controller to the new set. I might even keep the transition controller in memory at all times.

But this would require me to set up the transition process very explicitly to work with such a system. I find it a shame that I can’t just swap out the assets in memory for a new set of assets.