Gi guys, i’m creating a horror game, and i’m looking to add a ghost detector, i wan’t it so that if there is a collider in a certain range, it’ll detect and the light will go red if your too close, and if you’re further away you have a green ligh. anyone know how to do this?
While I agree with the first comment (always tell people what you have already tried) I think you’re going about it the wrong way.
I wouldn’t bother having a collider - it’s simply not needed.
Just keep a list of active ghosts and every frame compare their position to the current camera position. It’s far less expensive than using colliders to do the work for you, and you won’t get the problems that occur with trigger colliders.
Colliders detect hits and exits, but can’t count the number of items within the boundaries of the collider - so you’ll have to keep a list anyway. So just do it the old fashioned way.