Skip to content

Instantly share code, notes, and snippets.

@ElasticSea
Last active August 15, 2019 18:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ElasticSea/cd751d0240f057a2afc4b3b8ceb311cb to your computer and use it in GitHub Desktop.
Save ElasticSea/cd751d0240f057a2afc4b3b8ceb311cb to your computer and use it in GitHub Desktop.
Using cloth and skinned mesh renderer in 2018.4 messes up the renderer bounds. The renderer bounds end up being outside camera view and the object is culled and not rendered. Here is a quick fix how to force the renderer bounds to correct position. https://issuetracker.unity3d.com/issues/adding-cloth-component-to-skinnedmeshrenderer-changes-bounds
using UnityEngine;
namespace _Framework.Scripts.Util
{
public class FixSkinnedMeshRendererBounds : MonoBehaviour
{
[SerializeField] private SkinnedMeshRenderer skinnedMeshRenderer;
private void OnRenderObject()
{
skinnedMeshRenderer.localBounds = skinnedMeshRenderer.sharedMesh.bounds;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment