Forum rules - please read before posting.

Custom UI

edited August 2022 in Technical Q&A

Hi, been working on a making a main bar with buttons including all menus (Unity Prefab UI)
changing say Inventory to open with both a button press and clicking a button, closing any other menus and so on.
Some work, others do not BUT for example, the pause menu does a curious thing in that the Save button gets disabled the first time you open it and reactivates when you load anything else and go back to it. Why? How to fix it?
And something I didn't quite expect to happen but it does make sense, if you press again, Options or Pause and equivalents, I have them as pause game on, so no worries there but if I press Inventory the player can move around freely with the inventory bar in scene, obscuring part of the screen.

I was going to fix this by placing engine manage systems and disable movements but interactions are where it gets tricky, I thought of using items as ways to start conversation and click on puzzles but you can see how many things break here.

Comments

  • the pause menu does a curious thing in that the Save button gets disabled the first time you open it and reactivates when you load anything else and go back to it. Why?

    It's not possible to save the game while AC is in "cutscene" mode, i.e. a gameplay-blocking ActionList.

    As a safeguard, the Pause menu's SaveButton element will automatically hide itself if found to be in a cutscene at the time. If you want to control this manually, rename the element to something else and use the Save: Check Action in the Pause menu's "ActionList when turn on" asset to determine if saving is currently possible, and follow it up with Menu: Change state Actions to manually hide/show the save button.

    if I press Inventory the player can move around freely with the inventory bar in scene, obscuring part of the screen.

    It's possible to pause the Inventory menu as well - or do you want the game to continue while it displays?

    You will indeed have to be careful if you rely on *Engine: Manage systems Actions to disable Interactivity / Movement while the Inventory menu is on - but it can be scripted to occur automatically. e.g.:

    using UnityEngine;
    using AC;
    
    public class AutoUpdateInteractivity : MonoBehaviour
    {
    
        public string inventoryMenuName;
        private Menu inventoryMenu;
    
        void Update ()
        {
            if (inventoryMenu == null)
            {
                inventoryMenu = PlayerMenus.GetMenuWithName (inventoryMenuName);
            }
            if (inventoryMenu != null)
            {
                KickStarter.stateHandler.SetInteractionSystem (!inventoryMenu.IsOn ());
                KickStarter.stateHandler.SetMovementSystem (!inventoryMenu.IsOn ());
            }
        }
    }
    

    If you're using Unity UI, it's also possible to add invisible Buttons surrounding it to prevent clicks on the rest of the screen from registering. These needn't be added to AC via the Menu Manager if you have Unity UI blocks interaction and movement? checked in the Settings Manager.

  • Sorry, got carried away with other parts of the project, forgot about my draft.
    I was thinking about having the game continue while the inventory bar is open, so that the player can interact with the world and such, although inventory interactions might replace that.

    Getting the menus to appear and the saving system really are the hardest part of this.

  • edited August 2022

    What specific issue with it are you currently having? Any screenshots you can share will help me understand the situation.

    If you haven't seen it, the Manual's "Saving and loading overview" chapter covers the principles involved with the save system.

  • edited August 2022

    Ok, I'll share screenshots later. Again, for some reason imgur just won't work.
    The end goal is the same function as
    Clean and diegetic. The animation is another topic but the functionality and how it relates to AC, that's the main thing here.

    I found two other threads with relevant information. The principle is the same I think.
    https://www.adventurecreator.org/forum/discussion/5068/multiple-inventory-boxes-change-visibility-via-script
    https://adventurecreator.org/forum/discussion/6340/switch-between-inventoryboxes

    So after reading this and some relevant sections on the manual again, I get this.

    The sudden switch is no problem, on input, add input/on click.
    Grouping all the possible menus of the game and making the action list, let alone the proper in menu transitions and objects, this is troublesome to say the least.
    Possible only using prefabs or needs scripting?

  • edited August 2022

    Certainly scripting can always be used to aid more complex designs such as the one in your example video. To have "section tabs" at the top, however, shouldn't strictly require it.

    One approach would be to place all elements of all pages in a single menu, and then show/hide the various pages when each tab header button is clicked. If each page was in its own Hierarchy, you could use animation or scripting to enable/disable each page. This'll quickly get overwhelming with each page added, however, particularly in the Menu's Elements list.

    What might be easier is to have each page be a separate menu - with the header above being a separate menu as well. As each tab button is clicked, it turns on the correct "page" menu, and turns off the others.

    For this approach, I'd recomment keeping your Menu "Appear type" fields as "Manual", so that they only turn on when using specific Actions (or again, scripting).

    Rather than having your top header menu be set to appear "On Input Key", you have more control over things to set it to Manual and rely on Active Inputs to turn it on. Active Inputs are a way to run ActionLists when specific inputs are pressed under given circumanstances, in which you can then run further logic to initialise your menus. The Manual's "Active Inputs" chapter goes into more detail on this topic.

    One other note I should make is that you're not limited to using AC for your interface. AC is designed to work with custom scripting where additional functionality is needed - AC's menu system still relies upon the same core API that can be accessed through custom scripts. It's also often the case that a mix of both is best - the Manual's "Menu scripting" covers how the Menu system can be accessed through scripts.

    This is only generally speaking, however. If you'd like advice on something more specific, share details and I'll see what I can do.

    Regarding imgur posting: pasting hard links is enough, if images aren't showing within the reply box.

  • Thanks, Chris, yeah that worked out just fine except for the Save and Load, those two I'll separate given that the whole pause thing.

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.