using UnityEngine; namespace NanoBrain.Unity { /// /// The Unity ScriptableObject to implement re-usable Cluster Prefabs /// [CreateAssetMenu(menuName = "Passer/Cluster")] public class ClusterPrefab : ScriptableObject { /// /// The cluster data /// public Cluster cluster; //[HideInInspector] public int version; // #if UNITY_EDITOR // private bool queuedIncrement = false; // private void OnValidate() { // Debug.Log("Validating..."); // if (queuedIncrement) { // Debug.Log("Re-entry"); // return; // avoid re-entrancy // } // queuedIncrement = true; // // Defer so Unity finishes its internal serialization/validate cycle first // UnityEditor.EditorApplication.update += IncrementVersion; // } // private void IncrementVersion() { // UnityEditor.EditorApplication.update -= IncrementVersion; // Debug.Log("updating version..."); // // Ensure object still exists and hasn't been destroyed // if (this == null) { // queuedIncrement = false; // return; // } // // Record for Undo and mark dirty so change persists // UnityEditor.Undo.RecordObject(this, $"Increment {name} version"); // version++; // UnityEditor.EditorUtility.SetDirty(this); // Debug.Log($"{name} Prefab changed, version {version}"); // // Optional: force Inspector repaint // //UnityEditor.EditorUtility.SetDirty(this); // // clear the flag // queuedIncrement = false; // } // #endif } }