i just want to be able to detect all colliders that the mouse is hovering over - this really shouldn’t be difficult but obviously im missing something.
right now my code looks like this
void Update() {
RaycastHit[] hits;
hits = Physics.RaycastAll(Input.mousePosition, Vector3.forward, 100.0F);
int i = 0;
while (i < hits.Length) {
RaycastHit hit = hits*;*
-
Debug.Log (hit.collider.gameObject.name);*
-
i++;*
-
}*
- }*
I know its bad form to put a debug log in update and its not going to stay there. At the moment that debug log doesnt even run - i assume because nothing gets added to hits. can some one point me in the right direction for this? please note that I don’t want to have to click, and i dont want to cast from a game object. i just want them all to be detected when i hover over it.