- Home /
Double-click Detection script on every Game Object?
I'd like to detect a double-click as a means of selecting a game-object in my scene.
I think I can do the detection script fine, but this will mean putting the detection script on every potential selectable game object in the scene. Manually, prefab, or by writing another script to do the assignment and dis-assignment intelligently.
Is there a more elegant of doing this?
I've been trying to consolidate a lot of object duties onto a Controller/Manager type object. I'm trying to see how to do the double-click detection with this object, but it's not coming to me.
Any ideas would be appreciated! (particularly with javascript)
Answer by jonas-echterhoff · Jun 09, 2010 at 01:44 PM
You could make one script, which casts a ray into the scene when the mouse is clicked, and then look at the GameObject hit by that ray. Look up Camera.ViewportPointToRay.
Your answer
Follow this Question
Related Questions
FPS Kit V2.0 & Uspeak 1 Answer
Array of GameObjects 4 Answers
Rotate Character Controller 1 Answer
How would I add iCade(bluetooth) controller to unity project for Iphone? 0 Answers