Firstborn/Assets/RPG Creation Kit/Scripts/Equipment System/AttachToMesh.cs

23 lines
570 B
C#
Raw Permalink Normal View History

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using RPGCreationKit;
namespace RPGCreationKit
{
public class AttachToMesh : MonoBehaviour
{
[SerializeField] SkinnedMeshRenderer attachTo;
[ContextMenu("Attach To Mesh")]
void Attach()
{
SkinnedMeshRenderer newMesh = GetComponent<SkinnedMeshRenderer>();
newMesh.transform.parent = attachTo.transform.parent;
newMesh.rootBone = attachTo.rootBone;
newMesh.bones = attachTo.bones;
}
}
}