acdamiani / schema

Visual intelligence for the Unity game engine

Home Page:https://schema-ai.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OverlapSphere does not check against Internal Types

ijisthee opened this issue · comments

Hey guys,

I guess I've found an error.

In Schema.Builtin.Nodes.OverlapSphere inside Tick method there are made checks against GameObject and Transform. But these are Unity GameObject and Transform Classes.

None of the 4 if statements returns true.

But if I change the code to:

public override NodeStatus Tick(object nodeMemory, SchemaAgent agent)
{
    Collider[] colliders =
        Physics.OverlapSphere(position.value, radius.value, layerMask, queryTriggerInteraction);

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

    if (hit.entryType == typeof(Schema.Internal.Types.GameObject) || hit.isDynamic)
        hit.value = colliders[0].gameObject;
    else if (hit.entryType == typeof(List<Schema.Internal.Types.GameObject>))
        hit.value = colliders.Select(collider => collider.gameObject).ToList();
    else if (hit.entryType == typeof(Schema.Internal.Types.Transform))
        hit.value = colliders[0].transform;
    else if (hit.entryType == typeof(List<Schema.Internal.Types.Transform>))
        hit.value = colliders.Select(collider => collider.transform).ToList();

    return NodeStatus.Success;
}

It works perfectly.

I'm using Unity 2022.3.16f1 (LTS).

Am I using it wrong or does that have to do something with the Unity Version ?

Thx in Advance

Thanks for letting me know about this! Yes, I believe this is an oversight from when I switched Blackboard type systems; it shouldn't have any relation to your Unity version. I'll post a fix soon.

Fixed by #11.