- Home /
Work around for nested prefabs? (for my use case - random levels)
I am aware that this has been a common problem for a long time (why has Unity not done anything about it yet? sigh) but I am currently working on my first project that is large enough for me to even notice that this problem existed.
I have found a couple of workarounds already but I don't find them especially useful for my current situation.
I am creating a game that has 'randomized' levels - basically I am creating many small sections of levels and they will be spawned in a random order. Each level section is a prefab (of an empty game object), with many prefabs as children for enemies and obstacles etc. Unfortunately, all the references to the enemy prefabs are lost, and I am finding that if I want to change something about an enemy I must go through every instance of it in the level sections and change it manually, which is fine for now since I have a small handful of level sections but obviously this will be incredibly painful as the project grows.
I found this solution which essentially is a dummy gameObject that spawns the prefab at runtime, which would be fine, apart from the fact that it doesn't allow for overriding properties (and I need to be able to do this for my game unfortunately).
I also found this in the asset store, however the reviews suggest it is far from bug-free and I don't want to just change my problem into working around the bugs in this tool, not to mention waste my money on a tool that isn't stable.
Has anyone had a use case like mine before? How did you work around it?
Thanks!
Answer by shadowsora · Jul 20, 2017 at 11:29 AM
I found a solution, using an idea given in a comment on this post: https://www.reddit.com/r/Unity3D/comments/50rwuf/i_just_found_out_there_are_no_nested_prefabs_and/
Basically, I create my level sections as separate scenes, and load the scenes additively. This basically allows for one level of nested prefabs! Works great!
Your answer
![](https://koobas.hobune.stream/wayback/20220612130057im_/https://answers.unity.com/themes/thub/images/avi.jpg)