Firstborn/Assets/RPG Creation Kit/Scripts/_ General/ConvertToRegularMesh.cs
Schaken-Mods 959e80cf72 assets upload
assets upload description.
2023-03-28 12:16:30 -05:00

22 lines
656 B
C#

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);
}
}