Forum rules - please read before posting.

Resolution tutorial Q: running the game in windowed mode?

edited March 2015 in Technical Q&A
Hi Chris,

just a simple question - hopefully.
I just finished the brilliant resolution tutorial, http://www.adventurecreator.org/tutorials/adding-screen-resolution-option along with part 2.
However, I can't seem to be able to run the builded game in windowed mode, despite having selected "Fullscreen window" in Player -> D3D9 Fullscreen mode. I even tried to take off the "Default is Full Screen" option but no luck.

I tried to take off the "Set Resolution" Actionlist which ran on start, and that that point it does work again. Is there anything I can add to the action so that I can add an option to have the game run in windowed mode?
I apologise if it's actually a complicated issue, but I can't grasp what's happening exactly. I don't see anything in the code that should force the game to not only adjust resolution but also forcing itself into going fullscreen.

p.s. I normally keep Unity's resolution+input dialog disabled.

Comments

  • Unity's Screen.SetResolution function takes three parameters, as you've seen in the tutorial - the third of these is a "fullscreen bool", and you'll have set it to "true" if you followed the tutorial exactly.

    In hindsight, I could have made this more clear.  However, the point of the tutorial is to explain the principles in adding video options, rather than the exact code you need for your game (because everyone's needs are different)

    Setting the bool to "false" instead would put it in windowed mode, but you'd probably want to extend the Action to make use of a "fullscreen bool" of your own that goes in the Global Variables list, just like the resolution one in the tutorial.  You could then combine these variables into the Action, and process not just the resolution, but also the fullscreen state, in one, e.g.:

    int resolutionSetting = GlobalVariables.GetIntegerValue (1);
    bool isFullscreen = GlobalVariables.GetBooleanValue (3); // For example
    if (resolutionSetting == 0)
    {
      // Set to 640x480
      Screen.SetResolution (640, 480, isFullscreen);
    }
    // etc

  • edited March 2015
    ooh, oohh.
    I feel dumb now. Following the tutorial, I didn't pay attention to that true\false boolean near the resolution numbers and somehow I had completely forgot about those, to the point that I couldn't find the boolean haha. That makes everything clear.
    Thanks also for the extra logic bit. That's of course what I planned to do. Gonna do that asap :)

    edit: done, and works! Yohoo!
  • edited January 2016
    Hi, we have a similar setup to this question, using an Action based on the tutorial and using GlobalVariables to update/get the fullScreen boolean and the resolutionSetting int.

    The ActionList on start game is calling the Set resolution Action. However, the value for the full screen GlobalVariable seems to always be "true" on start, until I go to the menu and notice that indeed it has been updated. Do GlobalVariables get initialized after the "ActionList on start game" field in the game's Settings?

    AC v1.46
  • @edmunito: Yes, it does look like linked Variables are being updated after the ActionList OnStart.  Non-linked variables, however, are OK.  I shall look into fixing it, but in the meantime you might want to look into delaying the Action by a fraction of a second by placing it in a delayed scene-based OnStart cutscene instead.
  • edited January 2016
    I just stumbled upon this too.

    I have a cutSceene that runs as at startup On start and some actions do not run. Just nothing, no errors, so I tried to delay with Wait Engine for 0.1 now it works. I thought I was alone in this.

    It is Actionlist: Run in Parallel > Object: Check Presence I had to sandwich  Engine: Wait in between two.
    AC 1.50b
  • Your game's global OnStart is not intended for manipulating objects or any action that occurs over time - that's what your scene OnStart is for.
  • edited January 2016
    I'm not using it for global OnStart, I'm using it  scene OnStart.

    It is affecting other stuff too.
    For instance I have an actionlist asset of music that runs on start ( I call it from my OnStart cutscene)
    And now I have to add Engine: Wait there too.

    It is probably affecting anything related with OnStart scene. I have to check it.
    I hope this will be fixed soon.

  • Provide a recreatable example in another thread, and it'll be fixed faster.
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.