Fix changing weight to receptors

This commit is contained in:
Pascal Serrarens 2026-02-19 17:30:56 +01:00
parent f9ce73fd7a
commit 97ea988cca

View File

@ -794,7 +794,17 @@ public class ClusterInspector : Editor {
} }
EditorGUI.indentLevel++; EditorGUI.indentLevel++;
synapse.weight = EditorGUILayout.FloatField("Weight", synapse.weight); float newWeight = EditorGUILayout.FloatField("Weight", synapse.weight);
if (newWeight != synapse.weight) {
if (synapse.nucleus is IReceptor receptor) {
Nucleus[] receptorArray = receptor.nucleiArray;
foreach (Synapse s in this.currentNucleus.synapses) {
if (s.nucleus is IReceptor r && r.nucleiArray == receptorArray)
s.weight = newWeight;
}
} else
synapse.weight= newWeight;
}
EditorGUI.indentLevel--; EditorGUI.indentLevel--;
} }
} }