22 lines
656 B
C#
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);
|
|||
|
}
|
|||
|
}
|