using System; using UnityEngine; namespace Lemon.GenericLib.Generics { [Serializable] public struct Optional { [SerializeField] private bool enabled; [SerializeField] private T value; public bool Enabled => enabled; public T Value => value; public Optional(T initialValue, bool start) { enabled = start; value = initialValue; } public void Set(T initialValue) { if (enabled) { value = initialValue; } } } }