The abstract class that I made within last two hours:
using System.Collections; using System.Collections.Generic; using UnityEngine; abstract public class TriggerAction : MonoBehaviour { bool lastTriggerState; // Start is called before the first frame update void Start() { lastTriggerState = gameObject.GetComponent<TriggerManager>().isTriggered; } // Update is called once per frame void Update() { if (gameObject.GetComponent<TriggerManager>().isTriggered) if (lastTriggerState == false) { lastTriggerState = true; OnTriggered(); } else { TriggeredUpdate(); } } protected abstract void OnTriggered(); protected abstract void TriggeredUpdate(); }