Forum rules - please read before posting.

In-Game menu query

Hi all ,
I am currently creating the in game menu screens for my adventure game and I have ran into a couple of issues with the options menu :
This is the options menu as it is just now :

As you can see , the buttons glow when you click them. Now with the subtitles button , I want the lightbulb to the right of it to toggle between being unlit and illuminated depending on if the subtitles are on or off. The overlay image I want to use when the subtitles are on is this :

Now I assumed that I could use the "on texture" shown below with the lit up bulb to make this work but there is no way to position it anywhere , it just automatically goes behind the button. Is there a way to make it work as I want without any coding experience?

Also you can see there is a white colon to the left of the subtitles text and I have no idea how to get rid of it, this is my current button setup :

Secondly , I want to ideally use images for the languages button instead of the white "original" text that you see. Is there a way around this , again ideally without coding as I have no experience whatsoever with it....

Any help would be greatly appreciated , as you can see, I really need to be able to set this menu up the way I have designed it for it to look right.

Comments

  • edited June 2020

    I want the lightbulb to the right of it to toggle between being unlit and illuminated depending on if the subtitles are on or off.

    The styling options for AC-menus is fairly stripped-down, and an AC Toggle element's graphic will cover the whole element.

    What you could do is instead make the whole thing one graphic (i.e. the "Subtitles" text and the light bulb), with on/off variants, and then supply that instead.

    Alternatively, you could make two Graphic elements beside it, one for the On texture, one for the Off (positioned over each other), and then use the following script to hide/show them based on the state of subtitles:

    using UnityEngine;
    using AC;
    
    public class SubtitlesMenu : MonoBehaviour
    {
    
        MenuElement subtitlesOnGraphic, subtitlesOffGraphic;
    
        void Start ()
        {
            subtitlesOnGraphic = PlayerMenus.GetElementWithName ("Options", "SubtitlesOnGraphic");
            subtitlesOffGraphic = PlayerMenus.GetElementWithName ("Options", "SubtitlesOffGraphic");
        }
    
        void Update ()
        {
            subtitlesOnGraphic.IsVisible = Options.AreSubtitlesOn ();
            subtitlesOffGraphic.IsVisible = !Options.AreSubtitlesOn ();
        }
    
    }
    

    (Paste that into a C# script named SubtitlesMenu.cs, attach to an empty GameObject in your scene, and name the two Graphic elements "SubtitlesOnGraphic" and "SubtitlesOffGraphic", as well as name the Options menu "Options".)

    However, the best way is really to rely on Unity UI instead. As Unity UI offers much more style control over your menu, it's recommended to use AC-based menus more for rapid protoyping.

    With Unity UI, your Subtitles option would be handled by a UI Toggle, which allows you to choose exactly what graphic gets changed, and where. You can learn more about switching to Unity UI in the Manual's "Unity UI menus" chapter, as well as this tutorial.

    there is a white colon to the left of the subtitles text and I have no idea how to get rid of it

    Uncheck Append state to label?.

    I want to ideally use images for the languages button instead of the white "original" text that you see

    This would take some further scripting, but not much. Again, this'll be a lot easier to do using Unity UI, since with that mode you can rely on Unity's animation system to control an Image component.

    Let's say you had an an Image component in your UI, and an Animator that changes that Image's graphic through animation (i.e. each Animation clip changes the Image's Graphic to a different image). You could then define an Integer parameter in that Animator (named e.g. "Language"), as well as wire up Transitions to have it determine how its value controls animation playback.

    AC records the current language as an Integer as well (0 = original lanuage, 1 = first translation, etc).

    Having that parameter be updated according to the game's current language would then just be a matter of attaching a simple script:

    using UnityEngine;
    using AC;
    
    public class AnimateLanguage : MonoBehaviour
    {
    
        void Update ()
        {
            GetComponent <Animator>.SetInteger ("Language", Options.GetLanguage ());
        }
    
    }
    

    It would be possible, however, to also manipulate an AC-based menu to change a Graphic element's texture. While I'd still recommend switching to Unity UI, let me know if you want to remain with AC and I can see about providing an AC-only script instead.

  • Thanks for such a detailed explanation @ChrisIceBox . Using your advice I managed to sort out the issues . Appreciate the help.

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.