Enable Disable Toggle State Monobehaviour Class

This commit is contained in:
Syntriax 2023-01-24 21:44:29 +03:00
parent 01da5f8864
commit af1e30058b
1 changed files with 6 additions and 0 deletions

View File

@ -20,5 +20,11 @@ namespace Syntriax.Modules.ToggleState
}
public Action<bool> OnToggleStateChanged { get; set; } = null;
protected void Awake()
=> OnToggleStateChanged += (state) => enabled = state;
protected void OnEnable() => IsToggled = true;
protected void OnDisable() => IsToggled = false;
}
}