Home > Net >  How to create a working Skinned Mesh Renderer manually?
How to create a working Skinned Mesh Renderer manually?

Time:10-09

When manually creating a Game Object and adding a Skinned Mesh Renderer component, it doesn't show anything when it should show my model, even though the model is selected in the settings. When dragging in an fbx asset with animations into the scene, it automatically creates the necessary Skinned Mesh Renderer component, and this one shows the model. Even though my manual settings are identical to the one generated by Unity, it still doesn't show the model unless I copy the settings from the working component to the nonworking one. What is going on here? Is there some settings I cannot see that are getting copied?

Edit: additional info

Unity version 2020.3.17f1

Steps to reproduce:

  1. Create Game Object Step 1

  2. Create Skinned Mesh Renderer component Step 2

  3. I set mesh and root bone here, as well as materials Step 3

  4. Mesh does not show in game or in scene view Step 4

  5. Drag asset into the scene to create a Game Object Step 5

  6. This shows correctly when done this way Step 6

  7. Copy settings Step 7

  8. Paste settings Step 8

  9. Delete the unwanted object Step 9

  10. The Original object is now showing Step 10

CodePudding user response:

I used C# to copy various properties from the working one to the nonworking one until one appeared to make it show, bones. There is no bones tab in the inspector for Skinned Mesh Renderer as it appears to be hidden from view.

To repeat more simply, setting SkinnedMeshRenderer.bones in C# is what made the model show.

  • Related