Forum rules - please read before posting.

Hotspot label appearance and update execution order in StateHandler.cs

Hey, we've noticed that the appearance and disappearance of the text when hovering with the mouse on the hotspot falls behind a little bit.

We have a "Hotspot" menu that has source of Unity Ui Prefab, appear type of On Hotspot, Position type of Follow Cursor and Transition type of None. The label following the mouse falls behind by two frames. That is if you hover over a hotspot it takes two updates until the text appears and if you hover away it takes two frames for the text to disappear. Also it lags behind the cursor movement by what seems to be one frame. I've tested this both with hardwaver cursor and software cursor, they don't make a difference.

We managed to find a possible partial solution to this problem by modifying the Update method of the StateHandler class. That is by moving the update all menus block:

if (!menuIsOff)
{
.......
}

below the block that starts with:

if (!interactionIsOff)
{
..........
}

This reduced the appearance/disappearance lag by one frame but had no effect on the one frame lag when the menu is following the mouse. So the question is twofold:
  1) Is there anything that can be done to completely remove the lagging/delay
  2) At a glance from the author is the partial solution we made pose any dangers to other functionality (is it likely that switching the execution order of those two blocks might have other undesired effects?)

Comments

  • 1) The mouse state/position is stored within PlayerInput, so moving calls to UpdateInput() in a simlar way could well narrow the delay further.  Can't see why the lag would be greater than one frame though, unless there's a delay with Unity UI updating in general.

    2) Quite possibly.  It needs a thorough examination before I'd make any such change officially.  I will have a look into it myself.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.