how do change Collider to feet a task?

tailevi

New member
So I've made few tasks myself a few months ago and I updated the behaviour design library lately and colliders[] won't work for me anymore and could not find any examples for colliders within a behaviour task I would really like an example

I would really like some help keeping my code update

that's my code inside a task for example:

C#:
public Collider[] EnemiesAround;



public override TaskStatus OnUpdate()
        {
   EnemiesAround. =  Physics.OverlapSphere(transform.position, radius.Value);
   var currentGameObject = GetDefaultGameObject(MySlef.Value);

   for(int i =0;  i < EnemiesAround.Length; i++)
            {
                if(EnemiesAround[i].tag != "Untagged" || EnemiesAround[i].tag != "Projectile" || EnemiesAround[i].tag != currentGameObject.tag)
                {
                  ViableTags = ViableTags + 1;
                }
            }

        }

how should I change it in a task so it would be correct?
cuz currently, I'm having " Collider' is a namespace but is used like a type " as an error
 
This sounds like it's more of a general C# question rather than related to the behavior tree task. It looks like you have a syntax error on this line:

Code:
EnemiesAround. =  Physics.OverlapSphere(transform.position, radius.Value);
 
I actually added the "EnemiesAround." by mistake here, the original code does not have the dot on it. and the task still claims I cant use colliders[] in a task.
only happen with colliders that are a part of a task
thank you for ur time Justin
 

Attachments

  • collider error.png
    collider error.png
    19.2 KB · Views: 3
  • collider error 2.png
    collider error 2.png
    11.5 KB · Views: 3
Ah, Behavior Designer includes a Colliders namespace so you'll want to use the full path: UnityEngine.Collider.
 
Top