Hello,
recently I’ve been working on the resource manager for my RTS game. I had looked on the internet for ideas and I found a way using Resource folder. It looks really easy and simple, but my only concern is safety. What if the user deletes the file or modifies it in some way. The asset file will be corrupted or will not be loaded because it does not exist anymore. That would break the game, if for example curtain unit could not be loaded. Or do I understand something wrong about this?
The thing I use now is Scriptable objects. I have two types of scriptable objects: “RecourceManager” and “Asset”. The “Asset” is just a name of the object and a gameObject prefab reference. Inside the “RecourceManager” I have a list of “Asset” objects and everytime I want to get a reference of an object I call a function and pass a name of object I want to receive. Then inside that function I loop through all the assets list and check if the name I passed exists in the list of “Asset” objects. If so I return the prefab reference.
This way works fine, but the only downside is that I have to reference the “RecourceManager” everytime.
Is this even a good way of making something like this or are there any better ways?
Thank you!