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 softmarshmallow · May 01, 2016 at 08:19 AM · buttononmousedownonmouseup

detect click on collider like button

OnMouseDown();

that one detects click. but what i want to do is making OnMouseUp() like a button the ui button doesnt work if user drag out of its place.

how can i make OnMouse~~() possible to cancle like ui button? will be much better without using raycast.

Comment
Add comment · Show 4
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 g__l · May 01, 2016 at 10:14 AM 0
Share

Not sure exactly what you aim to do but anyway you may find your answer here

avatar image Glurth · May 01, 2016 at 01:29 PM 0
Share

Sounds like you want to use http://docs.unity3d.com/ScriptReference/EventSystems.IPointerUpHandler.html

avatar image softmarshmallow Glurth · May 01, 2016 at 02:06 PM 0
Share

how to use??

  using UnityEngine;
  using System.Collections;
  using UnityEngine.EventSystems;
   
  public class IEventTest: $$anonymous$$onoBehaviour, IPointerUpHandler
  {
   
      public void OnPointerUp(PointerEventData eventData)
      {
          Debug.Log("Button " + eventData.pointerId + " up");
      }
  }


this didnt work..

attached collider 2d and nothing was wrong.. sure this does same thing as ui button does?

avatar image Glurth softmarshmallow · May 01, 2016 at 03:02 PM 0
Share

For this "sure this does same thing as ui button does" : try deriving your class from the button class, rather than monobehavior. e.g. IEventTest:Button.
(note: that class already defines OnPointerUp, you can simply override it.)

1 Reply

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

Answer by softmarshmallow · Jun 27, 2016 at 01:49 PM

 public void OnMouseUpAsButton()
 {
     card.CardSelected();
 }

this does what i ment

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

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Calling method once 2 Answers

Weird Boolean Problem c# 1 Answer

Adding Force with a GUI button 5 Answers

OnMouseUp and GUITexture 1 Answer

Activate an OnMouseDown event before clicking a UI button? 1 Answer


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