- Home /
How to disable referenced Prefabs being preallocated in memory??
Hi, There is something boggling up my mind. It seems to me that underneath the covers, the Unity engine is preloading ALL referenced prefabs from the disk, and into the RAM memory. Now I can't prove that, because I have not found any articles about this behavior, but apparently this is so after some testing.
I know that the Resources folder is stored in the Disk, and prefabs there only load into the RAM during first instantiation. However, the Resources folder does not work well for web projects, because all the contents of the Resource folder must be downloaded before the first scene is able to run, which prevents fast startup of games. So Using the Resource folder is not an option.
Is there a way to flag a reference to a prefab or some other solution, which will disable the Unity built in prealocation feature?
Am I correct when I say you'd like to have some kind of a partial resources asset preload feature? Is splitting the content up into asset bundles an option?
I want my resources to be in the disk up until I call the Instantiate button on that resource. Cause if I have a collection of lets say 50 NPC characters, but I only need to instantiate one. Then if I make a script that has 50 different references to prefabs, then all 50 of them will sit and eat up my mobile devices RA$$anonymous$$. However if I place them all on the resources then there wont be any way to start the game on Web without downloading all 50 of them right there in the first initialization scene. Splitting into two different projects (one for Web, another for $$anonymous$$obile) is a solution, but its nasty. And asset bundles is the opposite of splitting up, its combining assets into a Unity zip file.