- Home /
Question by
StianC · Jul 30, 2014 at 07:48 PM ·
clickonmousedowndelegateexternalonmouseover
How can I call OnMouseDown() from an outside script?
Is there a way for me to do something when an object is being clicked on without adding the functionality directly to that object. I've done something like this before with delegates, but I can't remember how to do it or where those scripts are.
Comment
Best Answer
Answer by Kiwasi · Jul 30, 2014 at 07:52 PM
Sure.
Basic method is to use a raycast from the camera through the mouse to find what you hit. Then do whatever as appropriate.
Your answer
Follow this Question
Related Questions
OnMouseDown for right mouse click without being hacky? 1 Answer
Pass Clicks Through Camera 2 Answers
Display message when OnMouseDown 2 Answers
Need help with my first script, changing cube colors 1 Answer
Click & Materials 1 Answer