- Home /
CombineChildren not working under ExecuteInEditMode()
I have a set of prefab objects that I create in a scene. Then I perform a set of operations on them and would like to save the result to a new prefab.
I thought that using ExecuteInEditMode() was my solution, and, in fact, it works very well in nearly every respect. The script works as intended in runtime, so I assume the code itself is fine.
However, CombineChildren doesn't appear to do anything in this mode.
The CombineChildren script shows up as attached to the correct parent objects, but the child objects are still all independent and there is no combined mesh as there is if the script is run in game/runtime.
any ideas would be appreciated!
Why do you need combine children to work in edit mode?
Answer by Flynn · Jan 17, 2011 at 11:07 AM
If you added the script BEFORE adding the children, the script had already executed the children combine, making it too late. To remedy this, just remove, and re-add the script.
If this is not the case, then it appears to be a bug. The only solution is to:
Run this code in play mode, without execute in edit mode. Drag the new combined children onto your desired prefab, and then exit play mode. This will most definitely work, and is how I used to do it before I learned of ExcecuteInEditMode.
Your answer
Follow this Question
Related Questions
Delete tris from mesh without consequences? 2 Answers
Combine Children and Unity 4.0.1 not working the same as in previous version 0 Answers
CombineMeshes Error on Run-time Meshes 2 Answers
Combining meshes (different materials) together for rotation/translation 1 Answer
Combine multiple rigidbodies? 2 Answers