Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
4
Question by nolifeYoshi · Mar 15, 2015 at 11:49 PM · triggermouseevent

Difference between OnPointerEnter and OnMouseEnter

Hello everyone! What is the difference between OnPointerEnter and OnMouseEnter (or OnPointerUp and OnMouseUp, etc)?

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

3 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Laiken · Nov 21, 2016 at 07:21 AM

I know this was asked a long time ago, but just in case someone finds this question on google like I did:

According to my findings, OnMouseEnter works on Colliders and "GUIElement" which is the name for the GUI system that was used before OnGUI. If you use OnMouseEnter on the UI, it won't work, so you have to use OnPointerEnter instead. And as you may suspect, OnPointerEnter won't work for colliders, in that case you will need to use OnMouseEnter.

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 Datapax · Nov 20, 2016 at 11:29 PM

Basicly the OnPointer methods are for use with the UI elements.

The OnMouse methods are to use with Colliders and GUI's.

This means, if you use OnPointer on Colliders it won't work. And if you use OnMouse on UI elements it won't work.

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 quiet00903 · Jun 20, 2017 at 01:01 AM

I'm new to Unity, But as far as I've test, OnPointerEnter can do what the OnMouseEnter does. The reason why we can't use OnPointerEnter directly is that the method is supposed to be under the control of the EventSystem which means that you should create a EventSystem with InputModule (By default Unity has done for us), and you should add a raycaster component to the Camera so that the EventSystem can find the GameObject which should be added collider component to call its callback function. What's more, with the OnPointerEnter you can get more information from the passed in parameter EventData which I haven't researched. That's all I know about them by now and I also wish someone could give a better answer. My English is poor, hope it will be useful to you.

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

How to match 2 UI objects with Pointer Click? 1 Answer

How to disable depth of field if Player moves Mouse X or Mouse Y for 2 seconds on trigger enter? 0 Answers

how to know sender of triggerenter event? 1 Answer

EventTrigger PointerEnter 1 Answer

How to enable the box collider tick box on a trigger event 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