Collide with multiple object at once(same frame)?

Sanjay

New member
It seem HasEnteredTrigger2D task only returns one gameobject at once.
How can I handle multiple gameobjects collide at the same time?
 
You're correct - HasEnteredTrigger2D only stores a single GameObject. In order to handle multiple GameObjects you'll need to create a new task which can set multiple GameObjects.
 
It seems OnTriggerEnter2D and behaviour tree tick occures different timing.

Is it okay to put all the code what I want to do at the moment collision in the
OnTriggerEnter2D method directly inside the new task
rather than return collision gameobjects and treat them in the behaviour tree?
 
OnTriggerEnter2D is called during the physics timestep, while the behavior tree ticks during the update loop so they will be at different times. There's nothing wrong with putting your logic directly inside OnTriggerEnter2D.
 
Top