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 RobGraat · Mar 19, 2016 at 02:24 PM · pointermouseoverevent handlers

Alternative for non-existing EventSystem.IPointerOverHandler

Hi,

I use the various EventSystems.EventSystem.IPointer[...]Handler interfaces to retrieve pointer interactions with a collider on a certain layer.

Problem is that I can track when pointer enters and leaves the collider, but I can't seem to determine wether the pointer is already over the collider's position before the collider is created.

IsPointerOverGameObject does not seem to work in the same way as the IPointer... interfaces. For example, OnPointerClick is not called when the collider is blocked by a UI element. But IsPointerOverGameObject always returns true so I see no use for it.

Q: Is there a way to determine to check each frame wether the Pointer is over a game object in a certain layer and not blocked by UI in the same manner as the other pointer event handlers?

Cheers, Rob

Comment
Add comment · Show 1
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 RobGraat · Mar 19, 2016 at 04:31 PM 0
Share

If no Physics Raycaster is added to any game object then IsPointerOverGameObject does return false when over a non UI object.

But the IPointerEventHandlers require a Physics RayCaster component added to the main camera.

The IPointerEventHandlers seem be to the proper way to handler the pointer events, but are thus not able to function simultaneously with IsPointerOverGameObject...

1 Reply

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

Answer by RobGraat · Mar 19, 2016 at 07:36 PM

Ok, got it working purely using IPointerEventHandlers by simple setting the game object to inactive and setting it to active in a later frame.

The OnPointerEnter method is then called when game object becomes active. From there on I can track wether the Pointer is over the plane collider using OnPointerExit/Enter.

Feels like an hack though.

(I use this to disable the tile selection indicator over a hex grid when the cursor is over UI elements. And the indicator should not be active when the cursor happens to be over the UI after the level is loaded.)

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

37 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 avatar image avatar image avatar image

Related Questions

How do I display "guideline(s)" with short descriptive text and/or Object name above object on Mouseover? Anyone? 0 Answers

How do I keep scroll rect working with custom pointer events? 1 Answer

OnPointerEnter & OnPointerExit NOT WORKING 2 Answers

(4.6 UI) Event Trigger - Pointer Exit - Not being detected if mouse moves too rapidly & calls PointerEnter 2 Answers

How to make a 3D Gui Text? 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