Timeline for Detect mouse click on object with no script attached
Current License: CC BY-SA 3.0
8 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Sep 5, 2014 at 4:25 | comment | added | SanSolo | Thanks for the pointers. I was able to alter it for 2D collider :) | |
| Sep 4, 2014 at 15:23 | comment | added | House | If it's a 2D collider, you need the 2D raycast. | |
| Sep 4, 2014 at 14:55 | comment | added | SanSolo | Yes I added BoxCollider2D to the object. Object name is not shown in the console. | |
| Sep 4, 2014 at 14:51 | vote | accept | SanSolo | ||
| Sep 4, 2014 at 14:50 | comment | added | House | Read the documentation on raycasting. You need to add colliders to the objects you want to be detected with the ray. Yes, the ray will be cast any time you press the mouse button, that includes when pressing for GUI items, you'll need to detect separately when clicking a GUI item and not allow the raycast in those situations. That's an entirely different question though and not suitable to be addressed in the comments of this answer. | |
| Sep 4, 2014 at 14:39 | comment | added | SanSolo | Also, the raycast is firing when i click my GUI buttons too. Is that a problem? | |
| Sep 4, 2014 at 14:33 | comment | added | SanSolo | Thanks. The first Debug line is printed to console. Then i get this: UnityEngine.Debug:Log(Object). But the last Debug line is not shown. | |
| Sep 4, 2014 at 14:19 | history | answered | House | CC BY-SA 3.0 |