[Blocker]Procedural generated skinnedmesh support?

Our game depends heavily on skinned meshes generated procedurally using scripts. However, when I run the game on the simulator, I keep getting a warning message saying that “Optimized skinned mesh renderers are currently not supported.” Because of this, the generated mesh does not appear in the scene. I know that I should disable the “Optimize Game Objects” option, but since the mesh is generated through a script, I don’t see a way to disable this option. This example code is similar to our main code and can give you an idea of how we implement skinned meshes.


Had exactly the same warning, anyone knows how to fix it?

1 Like


That message should probably be extended to include more information on how to debug and fix it - essentially, that message is triggered when a skinned mesh renderer has no bones or no root bone. In this case, it is possible that the script is not setting a root bone in the skinned mesh renderer. Can you give that a try and see if that resolves the issue?

I’ll make a ticket to fix up that error message to make it less opaque when things go wrong, hopefully will be able to incorporate it into the next patch.


I have a root bone attached for each skinnedmeshRenderer procedurally generated. Looks like that is not what is causing the error? :neutral_face:

just a note that blend dshape animations using Skinned Mesh Renderer does not work in MR mode or Immeresive mode… yet (?)

1 Like

In that case, maybe the number of bones in the skinned mesh renderer is somehow zero? The code for that error just checks for two things - if there are zero bones assigned to the skinned mesh renderer or if the root bone is null.

If things are still not working, please submit a bug report and a repro project. That’ll make it easier to figure things out!

1 Like

This is a sample code from the Unity documentation which gives the same error when I try to build it for VisionOS. Our code is basically the same as this. You can directly take this sample and have a look


I took a look at the sample script and with a few edits to the script was able to get it built and working mostly as-is in visionOS simulator.


Edits I made to script was setting rend.rootBone = bones[0] and moving clip.legacy = true to before clip.SetCurve(). I also changed the shader it was attempting to use.

If you run the sample script with these edits, do you run into the same warnings about “Optimized skinned meshes”? If things still aren’t working, can you please submit a bug report with a project that reproduces the error? Thanks!

I have just located the underlying issue. Our skinned meshes are generated using scripts, and they require frequent updates. Whenever I update a mesh, I call the ‘mesh.clear’ API to clear the vertices and refill them. But, instead of appearing in its original position, the mesh becomes twisted and appears in an unexpected location. Consequently, I have to destroy the existing mesh, create a new one using ‘new mesh,’ and populate it with the vertex data. Would it be possible for you to investigate this matter? I believe that calling ‘new’ each time may result in unnecessary garbage collection. Here is a sample of our code:

Thanks for the additional information, that definitely helps narrow down what could be going wrong!

To confirm, is the incident number for the repro project IN-67465?


1 Like

Sure. Based on the information I updated, you may need to adjust the direction how you to deal with this bug. :sweat_smile:


I finally got some time to look into it and have some theories on what’s happening.

The initial burst of “Optimized skinned mesh renderers are currently not supported” warning messages is because on the very first frame of play-mode, the skinned mesh renderer does not have any bones or a root bone. It’s only later, on subsequent frames, that the procedural mesh code kicks in and provides that information, at which point, PolySpatial is able to process it.

With the second problem, where updated meshes look wrong, I was able to repro it and have filed an internal bug to fix cases like this. As a workaround, what you can do is disable the skinned mesh renderers until you’ve assigned all the necessary data to it - root bone, bones, mesh, etc - then enable the skinned mesh renderer after a few frames, e.g.:

// fill in skinned mesh renderer data.
skinnedMeshRenderer.rootBone = gameplayRootBone;
skinnedMeshRenderer.quality = SkinQuality.Bone2;
skinnedMeshRenderer.localBounds = new Bounds(Vector3.zero, Vector3.one);
// set to false, let coroutine enable it after a few frames or milliseconds. 
skinnedMeshRenderer.enabled = false;


public IEnumerator enableSkinnedMesh(SkinnedMeshRenderer renderer)
     yield return new WaitForSeconds(1);
     renderer.enabled = true;

Let me know if that helps! Additionally, in the future, it would be much appreciated to condense the repro project to only the problematic game objects and components and provide repro instructions! I had to make some educated guesses on how to trigger mesh generation - was using the Show Original Mesh button in the ChunkBasedVoxelSkinnedMeshGenerator component, hopefully that’s the correct way of reproing this.