Reference Manager just for using prefabs?
Posted: Tue Apr 20, 2021 3:54 pm
Hey,
I'm creating an strategy game for mobile and I'm kinda struggling finding out which way is the best to balance between ingame performance and load/save times. First of all there is no auto-save, so the user can just save his game, when he is clicking on a "save"-button (meaning the time to actually save or load is not that important...or so I thought).
My first approch was to use the reference manager. Save a lot of stuff by references and with prefabs (for example resources, soldiers, buildings, etc).
But after like 5 minutes in the game, there were already tens of thousands of references and the ingame performance was getting poor. On the other hand, saving only took a couple of seconds.
My second approach was to save everything by value and don't use prefabs, so I can get rid of the Reference-Manager entirely. This led to saving times way over a couple of minutes. But hey, the ingame-performance was not getting worst over time...
So my next thought was to save everything by value (I use a lot of scriptable objects, so I can just save an int or whatever to reference this manually back to the scriptable object) and only reference prefabs. The problem I'm having with this, is that I can obiously not use ES3-Prefabs, without the Reference Manager. My current, really dirty solution is to "Clear();" the ReferenceManager every couple of seconds, so I don't get thousands of useless references, but can save my prefabs. Is there an possibility to maybe de/activate the referenceManager just, when I'm saving/loading. Or maybe deactivate the auto-updating references, so I don't have to Clean it manually.
I'm creating an strategy game for mobile and I'm kinda struggling finding out which way is the best to balance between ingame performance and load/save times. First of all there is no auto-save, so the user can just save his game, when he is clicking on a "save"-button (meaning the time to actually save or load is not that important...or so I thought).
My first approch was to use the reference manager. Save a lot of stuff by references and with prefabs (for example resources, soldiers, buildings, etc).
But after like 5 minutes in the game, there were already tens of thousands of references and the ingame performance was getting poor. On the other hand, saving only took a couple of seconds.
My second approach was to save everything by value and don't use prefabs, so I can get rid of the Reference-Manager entirely. This led to saving times way over a couple of minutes. But hey, the ingame-performance was not getting worst over time...
So my next thought was to save everything by value (I use a lot of scriptable objects, so I can just save an int or whatever to reference this manually back to the scriptable object) and only reference prefabs. The problem I'm having with this, is that I can obiously not use ES3-Prefabs, without the Reference Manager. My current, really dirty solution is to "Clear();" the ReferenceManager every couple of seconds, so I don't get thousands of useless references, but can save my prefabs. Is there an possibility to maybe de/activate the referenceManager just, when I'm saving/loading. Or maybe deactivate the auto-updating references, so I don't have to Clean it manually.