IPointerEnterHandler and IPointerExitHandler not working in RC1

Before, at least in 19, since 20 and 21 was really buggy, when I used IPointerEnterHandler and IPointerExitHandler interfaces and just moved my mouse around it worked perfectly (reacted when I enter or exit given area, mostly Image), however now when I moved from 19 to RC1 it seems, that mouse click is required to both event to trigger.

So, if I just start game and do nothing both events will not react. If I click with mouse anywhere in Game view it will react. If I press any key on keyboard reaction will stop until I do mouse click.

Is there some change somewhere I need to do to make both handlers to work properly or that is a bug (I did submit it as bug)

I attached rar with my project, that have One scene with simple scrip, that change color of image to red if inside and blue if outside.

Any ideas how to fix that if that is not Unity bug ?

Update …
It seems it is a bug, since Unity Bug report confirmed this as bug.

In a mean time, it seems back to B19 for me until that is fixed :frowning:

1842876–118187–uGUI Error.rar (135 KB)

I’d also like to just add to this that in B20 for me IPointerEnterHandler and IPointerExitHandler worked great, but now with RC1 their PointerEventData is now null. Is this the same bug?

hmm, can or cannot, since I did not even check what is in that PointerEventData, all I had was

    public void OnPointerEnter(PointerEventData eventData)
    {
        _image.color = Color.red;
    }

    public void OnPointerExit(PointerEventData eventData)
    {
        _image.color = Color.blue;
    }

and even tat did not trigger until I click somwhere

id file a bug report so we can take a look

sounds good, didn’t want to flood the bug reports if it was already reported.

It is Case 646787 in Unity bug systems.

@Burve thats weird because in my game its working.

@meapps are you sure you did not click before using that action, since it is working, but you need to perform mouse click even after any key press, if you do not do click it is not working (check attached demo)

its a bug you are right its only working because i trigger it with the drag first etc…

Just chiming in to say that I also ran into this bug. In Beta 20, my PointerEnter and PointerExit events worked perfectly.

In RC1, I have to click with the mouse before those events work.

I have the same error.

hmm, I feel, that is this is true uGUI just lost it’s value to me and I will be moving back to OnGUI() and ignoring mobile application, as I did before :frowning:

We are working on a fix. We will get back to you once done.

So this wasn’t really a bug but a design change we made in b20 for how we wanted selection to work. In the old version what happened was that when you moved the mouse selection reverted to the mouse, and canceled any keyboard focus. This was really bad because if you were typing in an input field and then bumped the mouse it would lead to the input being unselected.

The correct way to handle this is to allow separate states for hover and selected, and I’ve made a fork of the OS repo for this (follow the instructions on the landing page for how to use this):
https://bitbucket.org/stramit/ui/branch/case-646787

Alternatively if you just want the old behavior grab this branch:
https://bitbucket.org/stramit/ui/branch/InputModuleOldBehaviour

1 Like

hmm, Interesting, I did not try to work with keyboard focus (except for search field), and did not see any problems, maybe just not noticing.

One of the example I used (maybe not the best usage oh this functionality) was to allow user to move around in FPS mode, rotate and still have mouse active, so I created 2 areas on the sides and when player moved mouse inside there screen rotated, while he can still move around with AWSD keys. In RC1 (from B19) that was not working, since after each key press I needed to click back with mouse.
in similar way was broken my double click code (however there was no key input).

As for repositories, maybe I did something wrong with SourceTree, but I got error

On both repositories

hg clone https://bitbucket.org/stramit/ui -b InputModuleOldBehaviour

They are branches with the actual repository being https://bitbucket.org/stramit/ui

Awesome, that first option worked, at least I just needed one click to set focus to application and then key input did not break it.

Now just my question is - how this will work with next RC or proper 4.6. I assume manually rewriting dll’s is not a really long term solution.

As for uGUI buttons missing hover state, can’t you , worst case, just leave both options open for devs, so I can choose either one that will loose focus on key input, but always will work or one, that need specific focus, or this one with missing hover feature. King of giving option to devs is better then internally setting only one and then rest have less flexibility

Rc2 is out and your original system is back - it seems I will be needing Unity source code every time with every update, since UI is not usable in current state :frowning:

Yes currently how the custom dll’s that are built get read are based upon the unity release number. So every release we do you’ll have to pull and build the code. We did this atm to make it easier for use to determine bugs that were possibly created by the user in there own version of the ui.dll and to prevent a old version of the dll being used to report a issue we might have already fixed.

Is having to rebuild dll’s with every release the permanent solution to this issue? Or just a current workaround in the beta?