Skip to content

Commit

Permalink
fix null entryType (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
acdamiani committed Jan 30, 2024
1 parent 69687b5 commit 3bc87e4
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Editor/PropertyDrawers/BlackboardEntrySelectorDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -330,15 +330,15 @@ private static GenericMenu GenerateMenu(SerializedProperty property, FieldInfo f
private static void GenericMenuSelectOption(SerializedProperty property, BlackboardEntry entry,
Type entryType = null, string path = "")
{
EntryType.TryGetMappedType(entry.type, out Type mappedEntryType);
EntryType.TryGetMappedType(entryType ?? entry.type, out Type mappedEntryType);

SerializedProperty entryProp = property.FindPropertyRelative("m_entry");
SerializedProperty typeString = property.FindPropertyRelative("m_valueTypeString");
SerializedProperty valuePathProperty = property.FindPropertyRelative("m_valuePath");
SerializedProperty isDynamicProperty = property.FindPropertyRelative("m_isDynamic");

entryProp.objectReferenceValue = entry;
typeString.stringValue = entryType?.AssemblyQualifiedName ?? mappedEntryType.AssemblyQualifiedName;
typeString.stringValue = mappedEntryType.AssemblyQualifiedName;
valuePathProperty.stringValue = path;
isDynamicProperty.boolValue = false;

Expand Down
2 changes: 1 addition & 1 deletion Runtime/Blackboard/BlackboardEntrySelector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public Type entryType
if (!entry)
return null;

if (m_valueTypeString == _lastValueTypeString)
if (m_valueTypeString == _lastValueTypeString && _lastValueType != null)
return _lastValueType;

_lastValueTypeString = m_valueTypeString;
Expand Down
2 changes: 1 addition & 1 deletion Runtime/Blackboard/EntryType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static bool TryGetMappedType(Type entryType, out Type mapped)
{
if (!typeof(EntryType).IsAssignableFrom(entryType))
{
mapped = null;
mapped = entryType;
return false;
}

Expand Down
2 changes: 2 additions & 0 deletions Runtime/Nodes/Physics/OverlapSphere.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public override NodeStatus Tick(object nodeMemory, SchemaAgent agent)
Collider[] colliders =
Physics.OverlapSphere(position.value, radius.value, layerMask, queryTriggerInteraction);

Debug.Log(hit.entryType);

This comment has been minimized.

Copy link
@ijisthee

ijisthee Feb 4, 2024

I still get NULL at this point.


if (colliders.Length == 0)
return NodeStatus.Failure;

Expand Down

0 comments on commit 3bc87e4

Please sign in to comment.