Make InitializeCluster more robust

This commit is contained in:
Pascal Serrarens 2026-05-27 11:26:53 +02:00
parent 9d92767786
commit ca8cc526f6

View File

@ -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;