- Home /
How to trigger actions when clicked in particular area?
I have a grid (picture attatched) and need to trigger an action when the top right corner cube has been clicked on. Can anyone tell me how to do this (I am new to unity, so pardon me if I am being stupid)? Thanks in advance
No picture attached... :)
Start by looking at Camera.ScreenPointToRay and Physics.Raycast, and have a collider on the corner you want to be able to select.
Answer by Seth-McCumber · Nov 06, 2013 at 09:16 PM
Check Out The Docs On OnMouseDown() It Should Give You The Desired Effect So When You Click On The Collider, It Does Whatever
Sorry for asking this question, but, will the action take place only when clicked on the particular box (if script is attatched to it)?
Yes, It Only Applys To The Collider On The Object That You Attatched The Script To
Your answer
Follow this Question
Related Questions
block a raycast from passing through objects 3 Answers
Click on GameObject 0 Answers
RPC activating gameobject on Host instead of on the Client 0 Answers
How can play a movie from a button? 2 Answers