Unity 2022 compatibility
This commit is contained in:
parent
fb51cc8914
commit
808bb949cf
@ -54,14 +54,22 @@ namespace NanoBrain.Unity {
|
|||||||
return EditorGUIUtility.singleLineHeight + propertyExtraHeight;
|
return EditorGUIUtility.singleLineHeight + propertyExtraHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if UNITY_6000_0_OR_NEWER
|
||||||
private readonly Dictionary<EntityId, bool> _invalidCache = new();
|
private readonly Dictionary<EntityId, bool> _invalidCache = new();
|
||||||
|
#else
|
||||||
|
private readonly Dictionary<int, bool> _invalidCache = new();
|
||||||
|
#endif
|
||||||
|
|
||||||
private bool IsInvalidJson(SerializedProperty jsonFileProp) {
|
private bool IsInvalidJson(SerializedProperty jsonFileProp) {
|
||||||
TextAsset jsonFile = jsonFileProp.objectReferenceValue as TextAsset;
|
TextAsset jsonFile = jsonFileProp.objectReferenceValue as TextAsset;
|
||||||
if (jsonFile == null)
|
if (jsonFile == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
#if UNITY_6000_0_OR_NEWER
|
||||||
EntityId id = jsonFile.GetEntityId();
|
EntityId id = jsonFile.GetEntityId();
|
||||||
|
#else
|
||||||
|
int id = jsonFile.GetInstanceID();
|
||||||
|
#endif
|
||||||
if (_invalidCache.TryGetValue(id, out bool invalid))
|
if (_invalidCache.TryGetValue(id, out bool invalid))
|
||||||
return invalid;
|
return invalid;
|
||||||
|
|
||||||
|
|||||||
@ -41,7 +41,7 @@ namespace NanoBrain.Unity {
|
|||||||
#if UNITY_6000_0_OR_NEWER
|
#if UNITY_6000_0_OR_NEWER
|
||||||
EntityId id = serializedObject.targetObject.GetEntityId();
|
EntityId id = serializedObject.targetObject.GetEntityId();
|
||||||
#else
|
#else
|
||||||
int id = property.serializedObject.targetObject.GetInstanceID();
|
int id = serializedObject.targetObject.GetInstanceID();
|
||||||
#endif
|
#endif
|
||||||
string key = id.ToString();
|
string key = id.ToString();
|
||||||
if (!clusterViews.TryGetValue(key, out ClusterView clusterView))
|
if (!clusterViews.TryGetValue(key, out ClusterView clusterView))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user