CombineChildren.CS problem (w/ screenshot)

(Sorry in advance for the large image.)

Hey guys, I’m still trying to work out this bit with CombineChildren.CS in Unity Basic, and this time I’ve included a screenshot that I hope will be useful.

I’ve got simple incense burners here that total 94 vertices. I placed all three in this test scene, made two of them children of the third, then dropped the script onto the parent object. No effect.

I pulled the script directly from a support site, so I’m pretty sure the script itself is valid. The only variable I can think of to play with that I haven’t is the Static checkbox, but as you can see, it doesn’t seem to exist.
(I could’ve swore I found it a few weeks ago, and my boss showed me a screenshot of where it is in unity iPhone, but I can’t find it.)

In addition, I’ve also pasted a series of error messages that my boss got when he tried attaching the script to other parent objects in the game. Most of it seems self-explanatory,
but maybe it’s trying to tell me something I’m not getting.


Mesh.vertices is too large. A mesh may not have more than 65000 vertices.
UnityEngine.Mesh:set_vertices(Vector3[ ])
MeshCombineUtility:Combine(MeshInstance[ ], Boolean) (at Assets/Plugins/MeshCombineUtility.cs:170)
CombineChildren:Start() (at Assets/Plugins/CombineChildren.cs:83)

[/Users/build/builds/unity-iphone/iphone/Projects/../Runtime/Filters/Mesh/LodMesh.cpp line 452]

Mesh.normals is out of bounds. The supplied array needs to be the same size as the Mesh.vertices array.
UnityEngine.Mesh:set_normals(Vector3[ ])
MeshCombineUtility:Combine(MeshInstance[ ], Boolean) (at Assets/Plugins/MeshCombineUtility.cs:171)
CombineChildren:Start() (at Assets/Plugins/CombineChildren.cs:83)

[/Users/build/builds/unity-iphone/iphone/Projects/../Runtime/Filters/Mesh/LodMesh.cpp line 578]

Mesh.colors is out of bounds. The supplied array needs to be the same size as the Mesh.vertices array.
UnityEngine.Mesh:set_colors(Color[ ])
MeshCombineUtility:Combine(MeshInstance[ ], Boolean) (at Assets/Plugins/MeshCombineUtility.cs:172)
CombineChildren:Start() (at Assets/Plugins/CombineChildren.cs:83)

[/Users/build/builds/unity-iphone/iphone/Projects/../Runtime/Filters/Mesh/LodMesh.cpp line 558]

Mesh.uv is out of bounds. The supplied array needs to be the same size as the Mesh.vertices array.
UnityEngine.Mesh:set_uv(Vector2[ ])
MeshCombineUtility:Combine(MeshInstance[ ], Boolean) (at Assets/Plugins/MeshCombineUtility.cs:173)
CombineChildren:Start() (at Assets/Plugins/CombineChildren.cs:83)

[/Users/build/builds/unity-iphone/iphone/Projects/../Runtime/Filters/Mesh/LodMesh.cpp line 498]

Mesh.uv1 is out of bounds. The supplied array needs to be the same size as the Mesh.vertices array.
UnityEngine.Mesh:set_uv1(Vector2[ ]) (at /Users/build/builds/unity-iphone/iphone/Runtime/Export/Generated/Graphics.cs:1006)
MeshCombineUtility:Combine(MeshInstance[ ], Boolean) (at Assets/Plugins/MeshCombineUtility.cs:174)
CombineChildren:Start() (at Assets/Plugins/CombineChildren.cs:83)

[/Users/build/builds/unity-iphone/iphone/Projects/../Runtime/Filters/Mesh/LodMesh.cpp line 518]

Mesh.tangents is out of bounds. The supplied array needs to be the same size as the Mesh.vertices array.
UnityEngine.Mesh:set_tangents(Vector4[ ])
MeshCombineUtility:Combine(MeshInstance[ ], Boolean) (at Assets/Plugins/MeshCombineUtility.cs:175)
CombineChildren:Start() (at Assets/Plugins/CombineChildren.cs:83)

[/Users/build/builds/unity-iphone/iphone/Projects/../Runtime/Filters/Mesh/LodMesh.cpp line 606]

Failed setting triangles. Some indices are referencing out of bounds vertices.
UnityEngine.Mesh:SetTriangleStrip(Int32[ ], Int32) (at /Users/build/builds/unity-iphone/iphone/Runtime/Export/Generated/Graphics.cs:1071)
MeshCombineUtility:Combine(MeshInstance[ ], Boolean) (at Assets/Plugins/MeshCombineUtility.cs:177)
CombineChildren:Start() (at Assets/Plugins/CombineChildren.cs:83)

[/Users/build/builds/unity-iphone/iphone/Projects/../Runtime/Filters/Mesh/LodMesh.cpp line 718]

This has dropped off the front page without a peep, so I’m going to bump this. First last and only bump. If I don’t get the issue solved, I’ll just manually batch things.

I’m not familiar with the script in question, nor the process of batching in Unity, but I am familiar with the 65000 limit on vertices and batch rendering in general, so that error stands out.

It doesn’t seem likely that you would exceed that limit with only three little incense burners, surely something has gone wrong somewhere, but it seems to me that if you focus on that particular part of the problem the rest will probably fall in line as a result.

If the error is happening on line 83, it sounds like you have multiple materials. That doesn’t sound right, either.

Sorry I couldn’t be more helpful :frowning:

.

Try putting the script on an empty gameobject parent and putting the burners as children to it.

The lines of error script were from when he tried attaching the CombineChildren script to a fully populated level map. It’s easily possible that the populated map would exceed the hard limit.

Using combine children on all objects in an entire level is a bad idea. Not only do you run into this error, but even if you didn’t it would most likely kill your performance completely.

Generally, you use combine children to combine separate clusters of similar objects within the level. For instance, all the trees in the same park would be combined, but the same trees in a different park will get a separate combined mesh. If you don’t make separate clusters like that, all the trees in the scene will have to be rendered as soon as any one of them is visible.

I was under the impression that CombineChildren would only work if the children were identical to the parent?

That aside, I don’t know the exact mechanics of what he tried to do. If he was smart, he took the time to group models together in smaller clusters before applying the script. If I know him, though, he probably just threw them all into one basket to see what would happen.

And that last line is about what I was afraid of. But that answers one question definitely. Now to just figure out why the script isn’t functioning! :stuck_out_tongue:

If you had a house, made up of different meshes for walls, windows, door, roof, etc.
Those are ideal for combining into one mesh, since you would never normally render those parts individually.

Whole point of merging them is 1 mesh + 1 material is fast (less draw calls)
The only relationship between them really is that they should share the same UV map/texture.

You wouldn’t merge all the houses in the street since you want to use other things like LOD(level of detail) for each house.

So basically what I’m getting from all of this is that there is no logical reason why what I’m doing shouldn’t technically, if not satisfactorily, work.

Alright, thanks guys. =) If using an empty game object as a parent doesn’t work, I’ll just do this manually.

I don’t see any reason why it shouldn’t work on your 3 objects.

make sure you have-
standard assets/scripts/combinechildren.cs
standard assets/scripts/meshcombineutility.cs

a)Make a fresh scene. (still using island demo which maybe the problem)
b)Add a gameobject.
c)Parent your burner to it, and duplicate it couple times.
d)Add the script “combinechildren” to the parent.

Nothing I’m doing seems to be working properly. But then, that’s par for the course for an independent newbie. :stuck_out_tongue_winking_eye:

Thank you all for your help, but I can’t spend any more time on trying to manhandle this script. It sounds like the CombineChildren script just makes it easy to do what I’d intended to do manually anyway. So I’ll just get cracking on making atlases and pre-combining props and buildings.