using System.Collections.Generic;
using UnityEngine;
namespace NanoBrain.Unity {
///
/// The Unity ScriptableObject to implement re-usable Cluster Prefabs
///
[CreateAssetMenu(menuName = "Passer/Cluster")]
public class ClusterPrefab : ScriptableObject {
///
/// The cluster data
///
public Cluster cluster;
//[HideInInspector]
public int version;
///
/// Call this function to ensure that there is at least one nucleus
///
/// his is an invariant and should be ensured before the nucleus is used
/// because output requires it.
public void EnsureInitialization() {
this.cluster.prefab = this;
this.cluster.name = this.name;
this.cluster.nuclei ??= new List();
if (this.cluster.nuclei.Count <= 0)
new Neuron(this.cluster, "Output"); // Every cluster should have at least 1 neuron
this.cluster.instanceCount = 1;
}
#if UNITY_EDITOR
private void OnValidate() {
version++;
}
#endif
}
}