Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Tanoshimi2000 · Dec 17, 2015 at 01:40 AM · gameobjectgizmodouble-click

Can I detect a doubleclick on a Gizmo or GameObject?

Simple problem. I want to perform an action when a Gizmo (or the GameObject) is double clicked. Is there any way to watch for that event? I'd rather not build something that listens to the input for clicks and registers the space between them, but that seems like an option. Anything better?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Tanoshimi2000 · Dec 17, 2015 at 12:49 PM

So I think the closest thing is to use the Event system, specifically the Event.current.button I'm writing my own function to track the doubleclick, and I have it in the

 void OnDrawGizmoSelected()

function so it only runs when my gizmo/gameobject is the current selection.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by allenallenallen · Dec 17, 2015 at 11:11 AM

I just randomly came up with a solution and I don't know if it's the best but I'll share it anyway.

Each time a click is registered, you start a timer if a timer isn't already running. The time is set beforehand for the double click time. This timer will stop when the double click window time is gone. Set a boolean saying the timer is no longer running.

Each time a click is registered, you also check if there's a timer running. If a timer is running, call what happens for a double click.

Of course, this is completely reusable. You can call this separate script from elsewhere.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Tanoshimi2000 · Dec 17, 2015 at 12:46 PM 0
Share

Right. I appreciate the answer. I get that. I've done that before to make double clicks. I was just wondering how to read a click in the editor, or read a double click if it's possible.

I believe the closest thing I can do is write my own double click routine (using timers), and use the Event.current.buttoncommand to read the clicks.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

34 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Double-click Detection script on every Game Object? 1 Answer

using Contains(gameObject) to find and destroy a gameObject from a list 2 Answers

Forcing a GameObject to the highest depth (closest to camera) 2 Answers

gameObject.SetActiveRecursively 1 Answer

Rendermode: Cutout not working on gameobject from external asset bundle 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges