using System.Collections; using System.Collections.Generic; using UnityEngine; /// /// A super crummy, poor mans cross scene reference setup for capture points /// public class CapturePointReference : MonoBehaviour { public int capturePointIndex; public struct CapturePointAnimator { public int index; public Animator animator; } public static List capturePointReferences = new List(); private void Awake() { capturePointReferences.Add(new CapturePointAnimator() { index = capturePointIndex, animator = GetComponent() }); } private void OnDestroy() { for(int i=0; i < capturePointReferences.Count; ++i) { var r = capturePointReferences[i]; if(r.index == capturePointIndex && r.animator == GetComponent()) { capturePointReferences.RemoveAt(i); return; } } } }