playMaker

Author Topic: UI pointer multiple images  (Read 625 times)

Andorix

  • Playmaker Newbie
  • *
  • Posts: 14
UI pointer multiple images
« on: July 30, 2022, 02:04:28 PM »
Hi! Within a canvas I have a UI image (fingerprint circle in screenshot). When I hover over it I would like 2 new images to be activated (red and green circles in the screenshot), using UIOnPointerEnterEvent. The red+green circles are clickable, also raycasting. If I leave the area (pink oval in screenshot) I would like the red+green circles to deactivate, using UIOnPointerExitEvent.

The problem arises when the mouse hovers over the red/green circle- Unity registers this as leaving the pink oval (leave area), UIOnPointerExit is triggered and the red+green circle images get deactivated. I would like this to happen only when the mouse leaves the entire pink oval area. Is this not possible since multiple raycasting images on top one another always interfere? What is a possible solution?

Thanks!

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: UI pointer multiple images
« Reply #1 on: July 31, 2022, 09:28:01 AM »
Hi.
Have you tried if this one works :
UiIsPointerOverUiObject

Andorix

  • Playmaker Newbie
  • *
  • Posts: 14
Re: UI pointer multiple images
« Reply #2 on: August 07, 2022, 09:24:23 AM »
Hi, not sure how this would help?
Since UiIsPointerOverUiObject tests for all UI indiscriminately...
I need an object that tests if the pointer left a specific UI area, hence I used UiOnPointerExitEvent, because you can choose which gameobject to test.
The problem is that when I enter the area of a separate gameobject, placed on top of the 1st object, the 1st object registers this as "leaving" it's area. Yet the mouse pointer is still technically on top of it, just separated by an extra UI object.

I did try to use the event you suggested though, like this: State1 - UiOnPointerExitEvent. If the event is sent, we flow to State2 - UiIsPointerOverUiObject. If pointer is over UI, we return to State1. If not, we return to State0 - UiOnPointerEnterEvent. But since all the background is made of UI objects, it always returns to State1 (I tried turning off raycasting for all of them).

Andorix

  • Playmaker Newbie
  • *
  • Posts: 14
Re: UI pointer multiple images
« Reply #3 on: August 16, 2022, 10:38:41 AM »
bump..

Andorix

  • Playmaker Newbie
  • *
  • Posts: 14
Re: UI pointer multiple images
« Reply #4 on: September 16, 2022, 02:26:34 PM »
final bump..

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: UI pointer multiple images
« Reply #5 on: September 18, 2022, 02:28:59 PM »
HI.
you probably need to add some checkers , something like :
On pointer exit :
if new raycast object = red or green circle, do next frame event and go back to UiIsPointerOverUiObject