Forum rules - please read before posting.

Interaction menu moves to the bottom of the screen

edited December 2024 in Technical Q&A

Hey everybody,
hey Chris!

I'm having a weird problem. When I click a hotspot, the interaction menu moves to the bottom of the screen and when there are two options, the interaction menu moves to the left or to the right of the screen at the bottom. I'm sure I have set something wrong by accident, but I can't figure out what it is.

I haven't really changed anything in the menu manager Interaction menu configuration and it doesn't make a difference if "always fit within screen" is selected or if I have the auto-correct UI component attached. It should appear at the hotspot and stay there, but then it moves to the bottom of the screen in a smooth way (not suddenly).

Specs:
AC: v18.2.1
Unity: 6000.0.31
New Unity Input System Integration imported and installed via the New Game Wizard

Any help would be appreciated!

Comments

  • Sounds very strange - any chance of a video/screenshot to show the issue occuring?

    What's your movement method / camera set up like, and what are the properties of your Interaction menu?

  • I can make a video, but before I do that I will try to explain the situation a bit more.

    A very important part of my game will be the ability to change between point-and-click and direct gamepad input. I'm using the Input System integration and there is a script attached to the EventSystem that is responsible for changing AC configurations whenever the "OnSetControlScheme"-Event is invoked by the ControlsReader component, but it also subscribes to an AC event if a menu gets turned on:

    private void OnEnable() 
    { 
        EventManager.OnMenuTurnOn += OnMenuTurnOn;
    }
    

    The OnMenuTurnOn method looks like this:

    protected virtual void OnMenuTurnOn(Menu _menu, bool isInstant)
    {
        if (!_isActive || string.IsNullOrWhiteSpace(_currentDevice))
        return;
    
        var config = GetConfigForDevice(_currentDevice);
    
        if (_menu.title.Equals(_menuNameHotspot))
        _menu.uiPositionType = config.HotspotMenuPositionType;
    
        if(_menu.title.Equals(_menuNameInteraction))
        _menu.uiPositionType = config.InteractionMenuPositionType;
    }
    

    Now if I set the InteractionMenuPositionType to "OnHotspot", I get this weird behavior. If I set it, for example, to "AbovePlayer", the problem is not there.

  • What inputs are you pressing at the time, and does this occur when using AC as the menu's Source?

  • edited December 2024

    I'm pressing the InteractionA button on the gamepad to interact with the Hotspot and when I use (or just flick) the UI/Navigate axis (Left Stick or D-Pad), the menu wanders to the left or right respectively. Interestingly the problem is also there when I change the source to Adventure Creator.

  • Also it only happens when there are two (or probably more) options, but also with one interaction button it slightly moves to the hotspot and is not at a fixed location like it should be. Strange indeed.

  • And the position type is definitely set to "On Hotspot"?

    Open up AC's HotspotLabelData script and attach the following to the top of the GetPosition function at the bottom:

    Debug.Log ("Menu element: " + menuElement + ", Hotspot: " + hotspot);
    

    What gets shown in the Console at the time this occurs?

    Next, try temporarily removing the custom script, leaving it at this value by default in the Menu Manager.

    If it still occurs, temporarily remove Input System (just clear the Event Manager prefab at the top of the Menu Manager and switch back to Input Manager in the Project/Player settings). We'll need to eliminate the possible causes in turn.

  • The debug log prints

    Menu element: Element ID 1; Use, Hotspot: Hotspot
    

    or ID 0, depending on the selected element.

    After removing the custom script, the problem was gone, but it comes back when I instead run an ActionList with "Engine: Manage Systems"-> "Direct-nav in-game menus: Enabled".

    Sorry, but how do I do this? "and switch back to Input Manager in the Project/Player settings" I removed the reference to the Event Manager Prefab and cleared the Input System Controls in the Project settings, but now my Player only moves in two directions and I can't interact with the Hotspot anymore, so I probably did something wrong there.

  • and switch back to Input Manager in the Project/Player settings

    It's the "Active Input Handling" option.

    Though, I think it's sounding like a case of the Menu attempting to position itself over it's own selected element.

    Could you PM me your Manager asset files as a .zip?

  • Ah good to know, I wasn't aware of this Active Input Handling option :) I sent you the zip as PM, thank you very much!

  • This should be fixable by opening AC's PlayerMenus script and replacing line 1697 (current release):

    if (!string.IsNullOrEmpty (_hotspotLabelOverride))
    

    with:

    if (!string.IsNullOrEmpty (_hotspotLabelOverride) && ((menu.IsUnityUI () && menu.uiPositionType != UIPositionType.OnHotspot) || (!menu.IsUnityUI () && menu.positionType != AC_PositionType.OnHotspot)))
    
  • Looks like you did it again, thank you, I'm really grateful!

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.