- Home /
Question is off-topic or not relevant
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 (https://docs.unity3d.com/ScriptReference/Physics.OverlapSphere.html) I need to detect the whole gameObject so that I can set it inactive. thanks :)
I don't understand the problem. create a trigger zone, attach a collider to the gameobject you want to disable and when entering the trigger do it. what exactly is the problem?
Because in the link above, the array stores colliders and not game objects, so if you cant use theArray[i].setActive(false); because it's a collider and not a gameobject
Answer by tormentoarmagedoom · Sep 11, 2018 at 03:19 PM
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.
hello, sorry about the question if it was irrelevant, hope it didn't bother u, thanks for the answer