• 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
1
Question by PorkMuncher · Jan 20, 2015 at 02:47 PM · ui4.6pointerexit

OnPointerExit doesn't work

In the new UI the OnPointerExit (aswell as OnPointerEnter) doesn't work if instead of pointer leaving(or entering) - the UI element itself is moved while the pointer is stationary. Is this how it should work and how do I work around it?

Comment
Add comment · Show 5
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 KurtGokhan · Jan 20, 2015 at 02:56 PM 0
Share

I can't confirm if what you say is true but I can think of a workaround if it is true. Everytime the object is moved, check if pointer is inside/ outside the object (see: RectangleContainsScreenPoint)(or you may have custom logic). For example, if it was outside before moving and inside after moving then invoke OnPointerEnter.

Also I wonder, if pointer gets inside the object when object is moved but OnPointerEnter is not called, after that, will OnPointerExit be called if you exit normally?

avatar image PorkMuncher · Jan 20, 2015 at 03:03 PM 0
Share

It calls the OnPointerExit when I exit the original location of the element, even though it isn't there anymore.

I don't move the button itself directly, but it's parent panel, for which I update its position every frame for smooth lerping.

Really weird...

avatar image PorkMuncher · Jan 20, 2015 at 03:49 PM 0
Share

I found that if I stop the manual movement the exit event gets called immediately after.

avatar image PorkMuncher · Jan 20, 2015 at 06:22 PM 0
Share

Ok - short summary in this video: https://www.screenr.com/pquN

avatar image KurtGokhan · Jan 20, 2015 at 06:26 PM 2
Share

Hmm, I can't think of anything about this. $$anonymous$$aybe you should report it as bug since you already have the video they will consider looking into it.

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by cucumars · Jul 01, 2018 at 10:03 AM

public class try1 : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

28 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

Related Questions

[4.6 - UI] How to call an event with button when the pointer is up the button image. 1 Answer

4.6 UI Text rect does not expand automatically 2 Answers

Unity 4.6 button movement problem 1 Answer

[4.6 - UI] Keep aspect ratio 2 Answers

Unity UI Button states 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges