- Home /
Replace asset in Unity resource manager
I have a game with many sprite texts - in scenes and in prefabs. All of them have references to font (text asset + material). These were added via inspector and are serialized. And now I think I need to be able to change the font in runtime, because I want to localize the game.
What looked promising was to rather then add some logic to sprite text component itself, get ID of this font in resource manager and replace it with some other font.
The alternatives, as I see them, are to edit sprite text to make the replacement, but it's from EZ GUI, so I'd avoid that. Plus that would mean adding extra logic to the class that probably shouldn't be there. Also I can think of adding extra component that would do everything I need, but this means adding it to so many places. And after that it's easy to forget to add this component for new sprite texts. As I understand, Asset Bundles don't keep external refs, so no luck here either.
Is it possible to replace asset in resource manager in runtime, so that refs will use the new one? Or are there better solutions?