Fix nullptr in nucleusarray

This commit is contained in:
Pascal Serrarens 2026-01-21 15:35:17 +01:00
parent f309d4cec6
commit c6d9f727c0
3 changed files with 9 additions and 7 deletions

View File

@ -23,9 +23,11 @@ public class NucleusArray {
this.name = nucleus.name;
this._nuclei = new INucleus[1];
this._nuclei[0] = nucleus;
this._clusters = new Cluster[0];
}
public NucleusArray(Cluster cluster) {
this.name = cluster.name;
this._nuclei = new INucleus[0];
this._clusters = new Cluster[1];
this._clusters[0] = cluster;
}

View File

@ -261,7 +261,7 @@ public class ClusterInspector : Editor {
normal = { textColor = Color.white },
fontStyle = FontStyle.Bold,
};
Vector3 labelPos = new Vector3(150, yMax, 0) - Vector3.down * (size + 0.2f); // below disc along up axis
Vector3 labelPos = new Vector3(150, yMax, 0) - Vector3.down * (size + 10); // below disc along up axis
Handles.Label(labelPos, this.currentNucleus.name, style);
}
else {
@ -412,7 +412,7 @@ public class ClusterInspector : Editor {
}
else {
style.alignment = TextAnchor.UpperCenter;
Vector3 labelPos = position - Vector3.down * (size + 0.2f); // below disc along up axis
Vector3 labelPos = position - Vector3.down * (size + 10); // below disc along up axis
Handles.Label(labelPos, nucleus.name, style);
}

View File

@ -13,19 +13,19 @@ MonoBehaviour:
m_Name: New Cluster
m_EditorClassIdentifier: Assembly-CSharp::Cluster
nuclei:
- rid: 2243601242842202225
- rid: 2243601242842202229
subClusters: []
references:
version: 2
RefIds:
- rid: 2243601242842202225
- rid: 2243601242842202229
type: {class: Neuron, ns: , asm: Assembly-CSharp}
data:
_name: Output
_synapses: []
_receivers: []
_array:
rid: 2243601242842202226
rid: 2243601242842202230
_curvePreset: 0
curve:
serializedVersion: 2
@ -53,9 +53,9 @@ MonoBehaviour:
m_RotationOrder: 4
curveMax: 1
average: 0
- rid: 2243601242842202226
- rid: 2243601242842202230
type: {class: NucleusArray, ns: , asm: Assembly-CSharp}
data:
_nuclei:
- rid: 2243601242842202225
- rid: 2243601242842202229
name: Output