private void OnEnter(Collider other) { bool isUnityAction = action.CheckUnityEventAction(); bool isCustomUnityEvent = refAction.CheckUnityEvent(); // For actions, handle setting this to inactive in the invoked object in order to do conditionally. if (isUnityAction || isCustomUnityEvent) { if (isUnityAction) { action.Invoke(); } if (isCustomUnityEvent) { refAction.Invoke(other.transform.GetParentRecursive <Transform>()); } } // For entering once. else if (game.ActivateTrigger(Id)) { Debug.Log($"{name} Entered: <{other.gameObject.name}> Setting inactive"); this.gameObject.SetActive(false); } if (isForceHide) { this.gameObject.SetActive(false); } }
public static void SafeInvokeDynamic <T>(this UnityEvent <T> unityEvent, T arg) { if (unityEvent.CheckUnityEvent <T>()) { unityEvent.Invoke(arg); } }