playMaker

Author Topic: Screen Resolution actions  (Read 21965 times)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Screen Resolution actions
« on: June 11, 2013, 07:25:49 AM »
Hi,

 Following a request, please find few actions to work with screen resolutions. The SetResolution action is not tested tho ( I never mess with my screen resolutions :) to begin with ) so if you have problems let me know.

-- ArrayListGetResolutions requires ArrayMaker, you can find it here:
https://hutonggames.fogbugz.com/default.asp?W715
it saves resolution inside a vector3: width,height,refreshRate.

-- GetCurrentResolution works on it own, arrayMaker not required

-- ScreenSetResolution works on it own as well.

GetCurrentResolution and ScreenSetResolution accepts a vector 3 as the resolution (width,height,refreshRate) so that if you use ArrayListGetResolutions, you can simply extract on of the resolution of the arrayList and use it as is without messing with it further.

bye,

 Jean

gecko

  • Junior Playmaker
  • **
  • Posts: 52
Re: Screen Resolution actions
« Reply #1 on: August 05, 2013, 04:54:26 PM »
Get Screen Resolution is exactly what I'm looking for....but how would I use this with Set Guiskin (with several guiskins for different device resolutions)? I don't know how to set/retrieve variables, so if it requires that, I'll go learn about it, but can you give me some guidance?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Screen Resolution actions
« Reply #2 on: August 06, 2013, 03:52:33 AM »
Hi,

 guiskin is only a system to define how component looks, not how they are placed on screen.

 can you precise what you are after?

bye,

 Jean

Gua

  • Beta Group
  • Sr. Member
  • *
  • Posts: 309
    • Andrii Vintsevych
Re: Screen Resolution actions
« Reply #3 on: October 06, 2014, 06:44:01 AM »
I don't understand how to get all list of resolution supported by user PC. The only thing I see when I use ArrayListGetResolutions is this.



I would like to see example or explanation.

Gua

  • Beta Group
  • Sr. Member
  • *
  • Posts: 309
    • Andrii Vintsevych
Re: Screen Resolution actions
« Reply #4 on: October 08, 2014, 04:04:14 AM »
I don't understand how to get all list of resolution supported by user PC. The only thing I see when I use ArrayListGetResolutions is this.



I would like to see example or explanation.

Looks like I've found the core of the problem.

"Screen.resolutions always returns 640x480 in the editor, presumably because there is no particular resolution in the editor; the game window can be anything. In a stand-alone or web player, though, Screen.resolutions does in fact return an array of all resolutions. You can see this in use with various Unity games that have in-game resolution switching (like this one).

--Eric"

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Screen Resolution actions
« Reply #5 on: October 14, 2014, 08:59:45 AM »
Hi,

When I run this, I have 10 items ranging from 640*480 to 1440*900, and I am in editor, on mac.

now when I run it on my pc laptop, I only get one... Maybe this is a bug, I have reported that to Unity, as it's the direct information I am accessing, I don't do anything fancy but just use this call:

http://docs.unity3d.com/ScriptReference/Screen-resolutions.html

Bye,

 Jean
« Last Edit: September 30, 2019, 02:05:35 AM by jeanfabre »

mweyna

  • Full Member
  • ***
  • Posts: 242
Re: Screen Resolution actions
« Reply #6 on: December 24, 2014, 03:43:23 PM »
From what I've seen, it looks like it's referencing the Monitor Resolution and not the Unity specific playback resolution. When I've set my desktop to difference sizes it pulls that size appropriately.

phannDOTde

  • Full Member
  • ***
  • Posts: 237
    • Peter Hann .de
Re: Screen Resolution actions
« Reply #7 on: February 25, 2015, 01:28:51 PM »
just to mention it: under windows "getresolution" returns the monitors desktop resolution not the actual renderwindow - cost me a day until I saw that.

mweyna

  • Full Member
  • ***
  • Posts: 242
Re: Screen Resolution actions
« Reply #8 on: February 25, 2015, 01:43:47 PM »
Hey Jean, do you know if this is tweaked or fixed in Unity 5?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Screen Resolution actions
« Reply #9 on: February 25, 2015, 02:10:24 PM »
Hi,

 These actions expose the Unity api:

http://docs.unity3d.com/ScriptReference/Resolution.html

 so, I am not sure how this can be fixed or tweaked, but maybe, if you have some links, I could study them and come up with appropriate actions.

Bye,

 Jean

phannDOTde

  • Full Member
  • ***
  • Posts: 237
    • Peter Hann .de
Re: Screen Resolution actions
« Reply #10 on: March 10, 2015, 07:04:37 AM »
an pretty easy work around is just to get screen width and screen height than you got your actual window res instead of the desktop res.

rezzer33

  • Playmaker Newbie
  • *
  • Posts: 1
Re: Screen Resolution actions
« Reply #11 on: September 25, 2019, 07:47:33 PM »
Hi,

When I run this, I have 10 items ranging from 640*480 to 1440*900, and I am in editor, on mac.

now when I run it on my pc laptop, I only get one... Maybe this is a bug, I have reported that to Unity, as it's the direct information I am accessing, I don't do anything fancy but just use this call:

http://docs.unity3d.com/ScriptReference/Screen-resolutions.html

Bye,

 Jean


 Bye,

 Jean

Hi Jean,

I know this post is really old but I cant seem to find anything else on the net about this.

I am also having the same problem. Though in my case, when I run it on a standalone I am getting 15 items. But when I run it in the editor, I only get 5 items. I have three monitors. My guess is this action is getting the resolution for ALL THREE monitors. (which explains having multiple same res)

Do you think that's the cause? If so, is there a way to fix this?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Screen Resolution actions
« Reply #12 on: September 30, 2019, 02:10:02 AM »
Hi,

As mentionned earlier, these actions only returns what Unity is providing or being provided by the OS... There is nothing much we can do here. Have you contacted Unity about this?


Bye,

 Jean

Broken Stylus

  • Beta Group
  • Hero Member
  • *
  • Posts: 772
Re: Screen Resolution actions
« Reply #13 on: September 30, 2019, 07:40:10 AM »
Using resolutions directly can be tricky though with all these canvas scalers.

Gua

  • Beta Group
  • Sr. Member
  • *
  • Posts: 309
    • Andrii Vintsevych
Re: Screen Resolution actions
« Reply #14 on: October 07, 2019, 08:46:00 PM »
I'm having issue with ArrayListGetResolutions in Unity 2018.4.5. It worked fine in Unity 5.6. It works fine in editor. But in a build I get duplicate resolutions. Here's demonstration of the issue (enable sound to get full picture).


Maybe this topic can help fix this action?
https://forum.unity.com/threads/screen-resolutions-returns-duplicate-entries-on-unity-5-5-3.467912/

Here's what happens there
https://i.gyazo.com/ee444b7ed0ac136be4d1c64d9429e63c.png
« Last Edit: October 07, 2019, 09:56:14 PM by Gua »