- Home /
Executing a script before loading assets of scene into memory
Why?
I've been working on a tool that will allow me to set the quality of all kinds of components based on game settings. That way, users will be able to enjoy my games the way they want / can. For instance, users with very slow phones/desktops that don't have a lot of memory should not use the highest resolution of textures.
The problem
Before I can change the component to use the correct quality setting, some assets (such as textures) may have already been loaded into memory! And that's not good, because if you use 4K textures, a crash could occur! (some phones don't support 4K)
What I want to be able to do
I've been thinking of several solutions, but I haven't been completelty satisfied with any of them. What I want to be able to do is:
Developer should be able to tweak settings and set defaults as they please in the Unity Editor.
Developer should be able to see the model/texture/... when not in play mode & when in play mode
Developer shouldn't have to do a lot before making a build.
When in play mode / in a build, the settings should be checked BEFORE actually loading the asests into memory.
None of the possible solutions I thought of satisfy all of these requirements. For example, I can't let developers just set the default to the lowest quality setting manually... because that is very error-prone.
Is there any way in Unity to ensure a script is executed BEFORE the assets are loaded, but at a point when all gameobject/components are already constructed in the scene?
If not, is there another way for me to ensure the defaults are set to the lowest quality when making a build (like a pre-build script going through all scenes and setting values... then reverting them when the build is finished/cancelled)?
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Quality level and cubemaps 1 Answer
build starts very slow despite fast in editor 1 Answer
Web Player build size growing .... 1 Answer
Help with making script efficient 3 Answers