Repost:
Here's a slight UI issue with an interactions menu that is shown when a hotspot is clicked:
https://gfycat.com/LongInfamousAsianporcupineIf the cursor is already overlapping, in this case the "mouth" button, the sprite swap isn't highlighted and requires the button to be re-hovered to chose the sprite swap highlight. This is a UnityUI issue, but since the highlight script is wired into AC (and I'm not sure how to work with that!) I was wondering if it could be sorted with OnPointerEnter?
public class CursorPreHoveringOverButton : MonoBehaviour, IPointerEnterHandler { public void OnPointerEnter(PointerEventData eventData) { Debug.Log("Hello"); } }
If that's placed on the interactions UI, it prints Hello in debug. Could that method be tapped into to force an initial check for a hover over anything?
public class CursorPreHoveringOverButton : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
{
[SerializeField] private Image mouthOpen, mouthClose;
public void OnPointerEnter(PointerEventData eventData)
{
GetComponent<Button>().image = mouthOpen;
}
public void OnPointerExit(PointerEventData eventData)
{
GetComponent<Button>().image = mouthOpen;
}
}
A slightly more convoluted version that requires each button to be defined, but the idea is similar. I'm not great with UI coding, so this is more just for suggestions in case anything could be integrated to force a menu update when it's loaded?
Comments
Also, whereabouts in the AC code is the highlight buttons taken care of? I'm trying to see if something can be initiated when the menu is turnedOn to trigger a cursor test for hovering to force a highlight if so.
Wonder why it doesn't highlight immediately, but rather a couple of nano-seconds late?