Forum rules - please read before posting.

Custom Action: Toggle between Full and Windowed screens

edited January 2021 in Extending the editor
using UnityEngine;
using System.Collections;

#if UNITY_EDITOR
using UnityEditor;
#endif

namespace AC
{

    public class SetFullWindowedScreenMode : Action 
    {
        // Declare variables here

        public bool isFullscreen ; 
        public SetFullWindowedScreenMode ()
        {
            this.isDisplayed = true;
            category = ActionCategory.Custom;
            title = "Set FullScreen or Windowed";
            description = "Set FullScreen or Windowed";
        }
        override public float Run ()
        {
             isFullscreen = GlobalVariables.GetBooleanValue (your Variable id); 
            if (isFullscreen == false) 
            {
                // Set to fullscreen
                Screen.SetResolution (1366, 768, true);
                GlobalVariables.SetBooleanValue(your Variable id, true);
            }
            else 
            {
                Screen.SetResolution (1366, 768, false);
                GlobalVariables.SetBooleanValue(your Variable id, false);

            }
            return 0f;
        }
    }
}
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.