Make InstantiateCluster more robust

This commit is contained in:
Pascal Serrarens 2026-05-27 13:03:32 +02:00
parent 5e73335997
commit 6bc6f19637

View File

@ -37,13 +37,18 @@ namespace NanoBrain.Unity {
}
private void InstantiateCluster(SerializedProperty property, ClusterView clusterView) {
if (property == null || property.serializedObject == null || clusterView.initialized)
if (property == null || clusterView.initialized)
return;
SerializedObject serializedObject = property.serializedObject;
if (serializedObject == null)
return;
UnityEngine.Object targetObject = serializedObject.targetObject;
if (targetObject == null)
return;
SerializedProperty prefabProp = property.FindPropertyRelative(nameof(Cluster.prefab));
UnityEngine.Object targetObject = property.serializedObject.targetObject;
if (targetObject == null)
return;
Debug.Log($"Instantiate new Cluster for {targetObject.name}");