- Home /
Why is Unity loading disabled GameObjects at scene start?
I have a scene with many GameObjects containing mesh chunks in it but to start with only one object is enabled, the rest are all disabled in the UI with the checkbox in the inspector. However, when I try and test the scene on a device with low memory (iPod 4 Gen) the scene crashes on startup with no error. If I delete all the objects except the active one it works fine. Clearly Unity is loading the disabled gameobjects into memory at startup, surely they should be loaded as they are enabled? If this is desired behaviour is there any way I can achieve this short of separating each object into its own scene and loading it asynchronously when needed?
Check the below answer for an alternative method. Just to explain more ins$$anonymous$$d: all objects you have in your scene are there, even if you de-activate them. Simply, stuff like Update etc is not called on them, and they're not taken into account when using methods like Find or physics.
Answer by Travis-Bulford · Jun 29, 2013 at 08:25 PM
You can make the objects you need into prefabs and store them in the Resources folder. Loading prefabs at run time is fairly well documented. This should solve your memory issue.
Your answer
Follow this Question
Related Questions
Do duplicate gameobjects use duplicate memory? 2 Answers
Using -Texture Quality: Half- res and mip maps 0 Answers
New Object Pooling Problem 1 Answer
Unity3D app crashes out after error "Warning -> ApplicationDidReceiveMemoryWarning' 1 Answer
Memory problems with procedurally generated meshes 2 Answers