using System.Collections.Generic; using UnityEngine; namespace UnityAtoms { /// /// Resets all the Variables in the list on OnEnable. Note that this will cause Events on the Variables to be triggered. /// [AddComponentMenu("Unity Atoms/MonoBehaviour Helpers/Variable Resetter")] [DefaultExecutionOrder(Runtime.ExecutionOrder.VARIABLE_RESETTER)] [EditorIcon("atom-icon-delicate")] public class VariableResetter : MonoBehaviour { public List _variables = new List(); void OnEnable() { for (var i = 0; i < _variables.Count; ++i) { _variables[i].Reset(true); } } } }