Forum rules - please read before posting.

Hotspot menu fading out over the wrong hotspot

edited May 2023 in Technical Q&A

I'm trying to figure out why the Hotspot menu in this repro is fading out on the wrong hotspot position (happens regardless of "Update while fading out"):
https://1drv.ms/u/s!Amz_vh8OYDX3vu8YRilTSB-amwHhtw?e=H2b5Al

Issue 1:
1. hover the mouse over the Door hotspot
2. hover the mouse over an inventory item - when moving the mouse away from the button, the fade-out animation will be shown over the Door hotspot instead of over the button

Issue 2:
1. hover the mouse a "switch player button" - notice that the Hotspot menu is shown in the middle of the screen rather than on the button
2. hover over the Door hotspot
3. hover over a "switch player button" again, same as Issue 1 - when moving the mouse away from the button, the fade-out animation will be shown over the Door hotspot instead of over the button

Thanks

Comments

  • Recreated - thanks, I will look into these.

  • edited May 2023

    I also found an issue with Menu.PositionOffset that is easy to recreate using the same repro:

    1. Open up RuntimeInput.cs and add the following line to Start():
      RuntimeMenu.HotspotMenu.PositionOffset = new Vector2(0, -20);
    2. Now play Scene1 and resize the Game window to mimic different screen ratios (using Free Aspect) - notice how the margin applied to the menu differs depending on screen ratio

    Thanks

  • The PositionOffset value you pass would need to be updated to reflect the changing size, as it will also need to account for the Canvas Scaler settings your UI uses.

  • edited May 2023
    Hmm, I'm not sure how to do that.
    If I understand correctly, this means I would have to do it continually as the screen size changes? Currently I only set it on the OnMenuTurnOn event.

    An idea:
    Since the "Auto-correct UI Dimensions" component already does the job of keeping menus in place according to the current aspect ratio, wouldn't it be perfect if that component would take the offset into account when doing it's calculation?

    Thanks
  • That component works by adjusting the Anchor Points of the RectTransform boundary when the screen size is changed.

    You could duplicate it and add a public offset to its ConvertToPlayableSpace function, but it would only be suitable for "edge" menus like the Inventory menu, that aren't otherwise repositioned (like the Hotspot menu).

  • I see. Do you have any suggestion as to how to get the menu offset to work for something like a Hotspot menu?
  • Perhaps if the menus offset value is used to affect the anchor points instead? I think that would work even if the menu has an auto correct component with all its anchor points set to 0.5.

  • Try it with a custom variant of AutoCorrectUIDimensions - it's not referenced externally, so can be replaced without interference.

    If you just wanted to offset the UI Hotspot label by a fixed amount, another option would be to just move the Text object to a child and offset the child.

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.