using System.Collections.Generic; using UnityEngine; namespace UniGLTF.MeshUtility { public class MeshIntegrationGroup { public string Name; public enum MeshIntegrationTypes { Both, FirstPersonOnly, ThirdPersonOnly, Auto, } public MeshIntegrationTypes IntegrationType = default; public List Renderers = new List(); public MeshIntegrationGroup CopyInstantiate(GameObject go, GameObject instance) { var copy = new MeshIntegrationGroup { Name = Name }; foreach (var r in Renderers) { var relative = r.transform.RelativePathFrom(go.transform); if (r is SkinnedMeshRenderer smr) { copy.Renderers.Add(instance.transform.GetFromPath(relative).GetComponent()); } else if (r is MeshRenderer mr) { copy.Renderers.Add(instance.transform.GetFromPath(relative).GetComponent()); } } return copy; } } }