diff --git a/Editor/Cluster_Drawer.cs b/Editor/Cluster_Drawer.cs index 79e9037..d8be713 100644 --- a/Editor/Cluster_Drawer.cs +++ b/Editor/Cluster_Drawer.cs @@ -102,6 +102,8 @@ namespace NanoBrain.Unity { cluster = SerializedPropertyUtility.GetManagedObjectForProperty(targetObject, property.propertyPath) as Cluster; } else { + // This does not work property yet it seems + Debug.Log("Instantiate"); ClusterPrefab clusterPrefab = prefabProp.objectReferenceValue as ClusterPrefab; cluster = new(clusterPrefab); object parent = SerializedPropertyUtility.GetParentObjectAndMember(targetObject, property.propertyPath, out var memberInfo, out int outIndex); diff --git a/Runtime/Scripts/Core/Neuron.cs b/Runtime/Scripts/Core/Neuron.cs index 7e9b9ae..0625801 100644 --- a/Runtime/Scripts/Core/Neuron.cs +++ b/Runtime/Scripts/Core/Neuron.cs @@ -351,13 +351,13 @@ namespace NanoBrain { /// /// True when the neuron is not persisting and has not be updated for timeToSleep seconds /// - public virtual bool isSleeping => !persistOutput && (Time.time - this.lastUpdate > this.timeToSleep); + public virtual bool isSleeping => !persistOutput && (Time.time - this.lastUpdate > timeToSleep); /// /// Check if the neuron is sleeping. /// /// This will reset the output value if it is sleeping public void SleepCheck() { - if (this.isSleeping) { + if (this.isSleeping && this.outputSqrMagnitude > 0) { #if UNITY_MATHEMATICS this._outputValue = new float3(0, 0, 0); #else @@ -373,7 +373,9 @@ namespace NanoBrain { /// /// Time in seconds after the last update the neuron can go to sleep /// - public readonly float timeToSleep = 1f; + public static readonly float timeToSleep = 1f; + + public bool breakOnUpdate = false; /// \copydoc NanoBrain::Nucleus::ShallowCloneTo public override Nucleus ShallowCloneTo(Cluster parent) { @@ -395,6 +397,7 @@ namespace NanoBrain { clone.curve = this.curve; clone.activator = this.activator; clone.curveMax = this.curveMax; + clone.breakOnUpdate = this.breakOnUpdate; } /// @@ -445,6 +448,9 @@ namespace NanoBrain { /// \copydoc NanoBrain::Nucleus::UpdateStateIsolated public override void UpdateStateIsolated() { + if (breakOnUpdate) { + Debug.Break(); + } var combination = Combinator(this.bias, this.synapses); this.outputValue = Activator(combination); this.lastUpdate = Time.time;