Detecting gameObjects in certain areas.

I need to detect gameObjects that enter an area (units going into buildings) storing them in an array and set them inactive (setActive(false)).
I found a solution for the detection but it was only for colliders (Unity - Scripting API: Physics.OverlapSphere)
I need to detect the whole gameObject so that I can set it inactive. thanks :slight_smile:

Good day.

You are lost my friend… You still need to watch so many tutorials and manuals. Your questions show us you really dont know how to acces, read, and store values and variables…

Realy, go learn about access components, acces values, acces objects, you need it. You are asking a very very basic question…

If you have the collider, you only need to acces its gameobject… and store them ina a Gameobject array.

collider.gameObject

Post closed.
Good bye.