Open UnexomWid opened 2 years ago
@AndrewIGD thoughts?
This works just fine, especially for non-GameObject assets such as sprites and audio clips, which don't require instantiation.
I'm not sure why someone would disable this, but there probably should be an option for this, just in case.
There should also be an option to preload ALL game assets via Resources.LoadAll("", typeof(Object))
, and that list should be stored inside TaleMaster such that they aren't unloaded until the game is closed.
Whenever assets are loaded dynamically, it's a well known fact that freezes can occur. This is because Unity loads assets in a lazy way. While this is fine in some scenarios, Tale is often used in games which feature high quality textures and audio files. These files are large, and therefore induce noticeable freezes during the gameplay.
There should be a way to mitigate this, without having to manually add every single asset to the preload list. A possible solution would be to move the resource loading task from the
Setup
state to the action constructor. This would work, because Tale actions are usually enqueued in bulk, meaning that all of the resources will be loaded in one go. The actions are also usually enqueued during the transition between two scenes, so the player shouldn't notice any freezes.In other words, instead of this:
...what should be done is this:
The difference is that any errors will be caught at the time of enqueueing the actions, and not when the action itself runs. If the user relies on dynamically generating assets, which don't exist at the time of enqueueing the action, then the action should retry loading the resources during the setup state.
Also, there should be a config option for enabling or disabling this behavior (i.e. loading resources at the time of enqueueing).