From ca8cc526f66ef0fcc49ae233eea3ea3a5e839493 Mon Sep 17 00:00:00 2001 From: Pascal Serrarens Date: Wed, 27 May 2026 11:26:53 +0200 Subject: [PATCH] Make InitializeCluster more robust --- Editor/Cluster_Drawer.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Editor/Cluster_Drawer.cs b/Editor/Cluster_Drawer.cs index f31c3d6..7608867 100644 --- a/Editor/Cluster_Drawer.cs +++ b/Editor/Cluster_Drawer.cs @@ -40,13 +40,15 @@ namespace NanoBrain.Unity { } private void InitializeCluster(SerializedProperty property, ClusterView clusterView) { - if (clusterView.initialized) + if (property == null || property.serializedObject == null || clusterView.initialized) 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}"); + // Debug.Log($"Instantiate new Cluster for {targetObject.name}"); // This does not work properly yet it seems ClusterPrefab clusterPrefab = prefabProp.objectReferenceValue as ClusterPrefab;