Forum rules - please read before posting.

Music and Sound Volume slider and a query cursor.

Hi

I am using a prebuilt slide from a GUI kit. Basically I want to change the volume of the music and the sound from a custom menu screen. I notice the options menu has this functionality built in. I was hoping it was possible to simple link the slider elements from the kit direct to the script used in AC for the options menu but was not able to find how you do that.

Is it possible to link with the AC script, and if so could you give me a pointer where to look? I'm using Units 5.6.7.

I am also using a custom cursor, however, one of the requirements of submitting to certain publishers is the requirement that the player can switch between a custom and the basic windows cursor. Is it possible to script that change or is it simply a matter of unlocking the custom cursor using actions and turning the custom cursor off.

Any help would be greatly appreciated.

Comments

  • edited November 2019

    Is it possible to link with the AC script, and if so could you give me a pointer where to look?

    See the Manual's "Save scripting" chapter for a list of available functions to get/set the various sound volume levels. For example, the music volume can be set with:

    AC.Options.SetMusicVolume (0.7f);
    

    I don't know how your custom GUI kit works, so I don't know exactly where such code would go - but you'll basically need to have two things going on:

    1. When the menu is shown, update the sliders to the current AC volume levels.
    2. When the slider's value is changed, change the AC volume level to match the slider's new value

    I am also using a custom cursor, however, one of the requirements of submitting to certain publishers is the requirement that the player can switch between a custom and the basic windows cursor.

    If your Cursor Manager's Cursor rendering field is set to Hardware, then the OnSetHardwareCursor custom event will fire whenever the cursor graphic is changed.

    You could hook into this event, and change it back to the system cursor if a Global Boolean Variable (i.e. "UseSystemCursor") is set to True:

    using UnityEngine;
    using AC;
    
    public class SystemCursorToggle : MonoBehaviour
    {
    
        public int boolVarID;
    
        private void OnEnable ()
        {
            EventManager.OnSetHardwareCursor += OnSetHardwareCursor;
        }
    
        private void OnDisable ()
        {
            EventManager.OnSetHardwareCursor -= OnSetHardwareCursor;
        }
    
    
        private void OnSetHardwareCursor (Texture2D tex, Vector2 offset)
        {
            if (GlobalVariables.GetBooleanValue (boolVarID))
            {
                Cursor.SetCursor (null, Vector2.zero, CursorMode.Auto);
            }
        }
    
    }
    
  • Hi Chris
    Thanks I really 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.