How?
I use Physics.OverlapSphere script.
From those colliders, how can I select some specific target randomly?
How?
I use Physics.OverlapSphere script.
From those colliders, how can I select some specific target randomly?
Physics.OverlapSphere gives you an array of colliders. This code selects one randomly:
// "a_colliders" is your array of colliders
var go_target : GameObject;
go_target = a_colliders[Random.Range(0, a_colliders.length)].gameObject;
(At least I’m pretty sure the code selects one randomly. I haven’t tested it.)