Let go food only at home

This commit is contained in:
Pascal Serrarens 2026-05-22 15:21:58 +02:00
parent 62bacfb1c0
commit 94df545222
2 changed files with 3 additions and 4 deletions

View File

@ -92,14 +92,13 @@ namespace NanoBrain.Unity {
if (property.serializedObject.targetObjects.Length == 1) {
UnityEngine.Object targetObject = property.serializedObject.targetObject;
Cluster_Drawer.selectedTarget = targetObject;
Cluster cluster;
if (clusterView.initialized || Application.isPlaying) {
cluster = SerializedPropertyUtility.GetManagedObjectForProperty(targetObject, property.propertyPath) as Cluster;
}
else {
// This does not work properly yet it seems
Debug.Log("Instantiate");
ClusterPrefab clusterPrefab = prefabProp.objectReferenceValue as ClusterPrefab;
cluster = new(clusterPrefab);
object parent = SerializedPropertyUtility.GetParentObjectAndMember(targetObject, property.propertyPath, out var memberInfo, out int outIndex);
@ -140,7 +139,7 @@ namespace NanoBrain.Unity {
}
private static void OnSceneGUI(SceneView sceneView) {
if (selectedTarget == null)
if (Application.isPlaying == false || selectedTarget == null)
return;
GameObject gameObject = null;

View File

@ -380,7 +380,7 @@ namespace NanoBrain {
/// <summary>
/// Time in seconds after the last update the neuron can go to sleep
/// </summary>
public static readonly float timeToSleep = 1f;
public static readonly float timeToSleep = 0.5f;
public bool breakOnUpdate = false;