Firstborn/Assets/RPG Creation Kit/Scripts/_ General/ConvertToRegularMesh.cs

22 lines
656 B
C#
Raw Permalink Normal View History

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ConvertToRegularMesh : MonoBehaviour {
[ContextMenu("Convert")]
void Convert()
{
SkinnedMeshRenderer skinnedMeshRenderer = GetComponent<SkinnedMeshRenderer>();
MeshRenderer meshRenderer = gameObject.AddComponent<MeshRenderer>();
MeshFilter meshFilter = gameObject.AddComponent<MeshFilter>();
meshFilter.sharedMesh = skinnedMeshRenderer.sharedMesh;
meshRenderer.sharedMaterials = skinnedMeshRenderer.sharedMaterials;
DestroyImmediate(skinnedMeshRenderer);
DestroyImmediate(this);
}
}