Playmaker Forum

PlayMaker Updates & Downloads => Official Action Updates => Topic started by: jeanfabre on June 11, 2013, 04:25:49 AM

Title: Screen Resolution actions
Post by: jeanfabre on June 11, 2013, 04: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
Title: Re: Screen Resolution actions
Post by: gecko on August 05, 2013, 01: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?
Title: Re: Screen Resolution actions
Post by: jeanfabre on August 06, 2013, 12: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
Title: Re: Screen Resolution actions
Post by: Gua on October 06, 2014, 03: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.

(http://i.gyazo.com/dc72e61c5e7bb6956df4f1c80e2d2db0.png)

I would like to see example or explanation.
Title: Re: Screen Resolution actions
Post by: Gua on October 08, 2014, 01: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.

(http://i.gyazo.com/dc72e61c5e7bb6956df4f1c80e2d2db0.png)

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"
Title: Re: Screen Resolution actions
Post by: jeanfabre on October 14, 2014, 05: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
Title: Re: Screen Resolution actions
Post by: mweyna on December 24, 2014, 01: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.
Title: Re: Screen Resolution actions
Post by: phannDOTde on February 25, 2015, 11:28:51 AM
just to mention it: under windows "getresolution" returns the monitors desktop resolution not the actual renderwindow - cost me a day until I saw that.
Title: Re: Screen Resolution actions
Post by: mweyna on February 25, 2015, 11:43:47 AM
Hey Jean, do you know if this is tweaked or fixed in Unity 5?
Title: Re: Screen Resolution actions
Post by: jeanfabre on February 25, 2015, 12: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
Title: Re: Screen Resolution actions
Post by: phannDOTde on March 10, 2015, 04: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.
Title: Re: Screen Resolution actions
Post by: rezzer33 on September 25, 2019, 04: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?
Title: Re: Screen Resolution actions
Post by: jeanfabre on September 29, 2019, 11:10:02 PM
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
Title: Re: Screen Resolution actions
Post by: Broken Stylus on September 30, 2019, 04:40:10 AM
Using resolutions directly can be tricky though with all these canvas scalers.
Title: Re: Screen Resolution actions
Post by: Gua on October 07, 2019, 05: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
Title: Re: Screen Resolution actions
Post by: jeanfabre on October 07, 2019, 11:40:11 PM
Hi,

 ok, pushed a new version of ArrayMaker on the Ecosystem, can you check it out, it features the mods you suggests, which I think is good.

Bye,

 Jean
Title: Re: Screen Resolution actions
Post by: Gua on October 13, 2019, 08:17:12 PM
Oops. In my previous post I've attached wrong file, so I've deleted it. Here's correct file

I'm not much of the a coder, but by reading on this issue and experimenting, I was able to fix this action. Fixed version is in attachment.
Title: Re: Screen Resolution actions
Post by: jeanfabre on October 13, 2019, 11:05:45 PM
Hi,

 I just pushed a version on the Ecosystem fixing this.

 Bye,

 Jean
Title: Re: Screen Resolution actions
Post by: hoyoyo80 on October 17, 2019, 06:19:26 PM
Thanks for this 8) I set my android project to 540p to support down to snapdragon 400 series devices:)