Unity 6 compatibility
This commit is contained in:
parent
133804a154
commit
1a7ca0e298
@ -26,15 +26,26 @@ namespace NanoBrain.Unity {
|
|||||||
|
|
||||||
public static readonly Dictionary<string, ClusterView> clusterViews = new();
|
public static readonly Dictionary<string, ClusterView> clusterViews = new();
|
||||||
public static ClusterView GetClusterView(SerializedProperty property) {
|
public static ClusterView GetClusterView(SerializedProperty property) {
|
||||||
string key = property.propertyPath + "_" + property.serializedObject.targetObject.GetInstanceID();//GetEntityId();
|
#if UNITY_6000_0_OR_NEWER
|
||||||
|
EntityId id = property.serializedObject.targetObject.GetEntityId();
|
||||||
|
#else
|
||||||
|
int id = property.serializedObject.targetObject.GetInstanceID();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
string key = property.propertyPath + "_" + id;
|
||||||
if (!clusterViews.TryGetValue(key, out ClusterView clusterView))
|
if (!clusterViews.TryGetValue(key, out ClusterView clusterView))
|
||||||
clusterView = new(key);// { key = key };
|
clusterView = new(key);// { key = key };
|
||||||
return clusterView;
|
return clusterView;
|
||||||
}
|
}
|
||||||
public static ClusterView GetClusterView(SerializedObject serializedObject) {
|
public static ClusterView GetClusterView(SerializedObject serializedObject) {
|
||||||
string key = serializedObject.targetObject.GetInstanceID().ToString(); //GetEntityId().ToString();
|
#if UNITY_6000_0_OR_NEWER
|
||||||
|
EntityId id = serializedObject.targetObject.GetEntityId();
|
||||||
|
#else
|
||||||
|
int id = property.serializedObject.targetObject.GetInstanceID();
|
||||||
|
#endif
|
||||||
|
string key = id.ToString();
|
||||||
if (!clusterViews.TryGetValue(key, out ClusterView clusterView))
|
if (!clusterViews.TryGetValue(key, out ClusterView clusterView))
|
||||||
clusterView = new(key); // { key = key };
|
clusterView = new(key);
|
||||||
return clusterView;
|
return clusterView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,11 @@ namespace NanoBrain.Braitenberg {
|
|||||||
protected override float SampleSensor() {
|
protected override float SampleSensor() {
|
||||||
float sum = 0f;
|
float sum = 0f;
|
||||||
// Get all active lights in scene (Point lights only)
|
// Get all active lights in scene (Point lights only)
|
||||||
|
#if UNITY_6000_0_OR_NEWER
|
||||||
|
Light[] lights = FindObjectsByType<Light>();
|
||||||
|
#else
|
||||||
Light[] lights = FindObjectsByType<Light>(FindObjectsSortMode.None);
|
Light[] lights = FindObjectsByType<Light>(FindObjectsSortMode.None);
|
||||||
|
#endif
|
||||||
Vector3 pos = transform.position;
|
Vector3 pos = transform.position;
|
||||||
Vector3 forward = transform.forward;
|
Vector3 forward = transform.forward;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user