Skinned Mesh Renderer only appears if it's visible in the Scene window

So, I’ve got an animated knife as a child of the first person camera. When I click, the knife swings. Everything works great! Except when the scene view isn’t pointed at my player…


If I play the game in a maximized game window, the knife doesn’t render. If I don’t play maximized, but don’t have the scene window on screen, the knife doesn’t render. If I walk out of view of the scene window, the knife doesn’t render.


It’s acting as if the scene view is my “camera,” and when the skinned mesh renderer isn’t displayed by that “camera” it doesn’t render. You’d expect this behavior but with the actual camera instead of the scene view.


I’ve never run into a problem like this before, so I’m very very confused. I’m sure there’s a setting or something that I’m overlooking. Any help is greatly appreciated :slight_smile:

Alright everyone, I’ve found a solution.

I don’t know exactly what fixed it, but I’ve changed a bunch of settings on the knife and camera. For anyone with a similar problem, here are the settings I suspect have something to do with it.

  • The Animator component has Culling Mode set to Always Animate.
  • The Skinned Mesh Renderer has Update When Offscreen checked true.
  • The Skinned Mesh Renderer has Dynamic Occluded set to false.
  • The Camera has Occlusion Culling set to true.
  • The Camera has Allow Dynamic Resolution set to false.

I’ll mark this answer as correct and leave the question here so it might help someone else.

Thanks hawksandwichgames your solution worked

@hawksandwichgames Actually only the

  • The Skinned Mesh RendererUpdate When Offscreen → checked true

does the trick.

However, this isn’t the ideal solution because it lowers the performance as the mesh bounds are remapped all the time. It’s ok if that happens for a single mesh but when you have them hundreds it can really impact the framerate.

Check: Unity - Manual: Skinned Mesh Renderer component
and Unity - Manual: Skinned Mesh Renderer component

the mesh is remapped when Update When Offscreen is set to true, when you set it back to false the bounds get to the original position.

in previous versions of Unity you could recalculate the bounds with this bit of code.

modelObject.GetComponent<SkinnedMeshRenderer>().sharedMesh.RecalculateBounds();

And that would be great so that I could remap the bounds when the animation happens. However, it doesn’t work anymore, or at least not for me…

For Anyone who’s facing this issue.

U need to set the rootbone position of the attached object to the position of the Main SkinnedMeshrenderer rootbone position

Example:

O1 = Main.GetComponent<SkinnedMeshRenderer>();
O2 = Attached.GetComponent<SkinnedMeshRenderer>();
O2.rootBone.transform.position = O1.rootBone.transform.position;

Looks like an Editor bug for me.
Nothing helped except this workaround.

Script attached to SkinnedMeshRenderer gameObject:

using UnityEngine;
  
[RequireComponent( typeof(SkinnedMeshRenderer) )]
public class ForceUpdateSkinnedMesh : MonoBehaviour
{
    [SerializeField]
    SkinnedMeshRenderer skinnedMesh;
  
    void Update()
    {
        skinnedMesh.enabled = false;
    }
  
    void OnRenderObject()
    {
        skinnedMesh.enabled = true;
    }
}