Forum rules - please read before posting.

Problem using direct control to navigate menus.

Im having an issue when using direct control and navigating menus.
I have some arrow buttons used to shift next/preview elements not visible in the container. I also have those arrow buttons set to only show when effective. The problem comes when I have the Arrow selected in Direct Control mode and I reach the end of the list making the button ineffective, so it shuts off. However, when it shuts off it takes the selection focus with it, so no menu items are highlighted and navigation becomes unresponsive creating a blocker in game progress.
Is there something I'm missing? Thanks!

Comments

  • edited August 2019

    I will attempt a recreation.

    1. What are your AC/Unity versions?
    2. Is the menu rendered with AC or Unity UI?
    3. Is the menu set to pause the game when turned on?
  • Im using Unity 2018.2.17f1 Personal
    AC v1.67.4
    The menu is rendered with Unity.
    Im specifically having problems with the Dialog UI Menu.

  • As you're using Unity UI, best to rely on a custom script to handle the re-selection of the dialogue list once the button turns off.

    Paste the below into a C# script named "ReselectElement", change the menu/element names to suit, and add it to your scene.

    using UnityEngine;
    using System.Collections;
    using AC;
    
    public class ReselectElement : MonoBehaviour
    {
    
        private void OnEnable ()
        {
            EventManager.OnMenuElementClick += OnMenuElementClick;
        }
    
        private void OnDisable ()
        {
            EventManager.OnMenuElementClick -= OnMenuElementClick;
        }
    
        private void OnMenuElementClick (Menu menu, MenuElement element, int slot, int buttonPressed)
        {
            if (menu.title == "Conversation" && !element.IsVisible)
            {
                if (element.title == "ScrollDown")
                {
                    menu.Select ("DialogueList", 3); // replace 3 with the slot index to select
                }
                else if (element.title == "ScrollUp")
                {
                    menu.Select ("DialogueList", 0);
                }
            }
        }
    
    }
    
  • Awesome!
    And sorry for my ignorance, but I have yet to work with scripts. How exactly do I add it to a scene? And do I add it to every scene?

  • Once in a C# script, you can attach it to any GameObject as a component named "Reselect Element".

    It would need to be present in every scene, yes, but you can alternatively add it to your PersistentEngine prefab, which is automatically present in every AC scene. This can be found in /Assets/AdventureCreator/Resources.

  • Works perfect! Thank you!

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.