Class GlobalResolutionSetter
Sets global rendering resolution.
Inherited Members
Namespace: UnityEngine.TestTools.Graphics
Assembly: UnityEngine.TestTools.Graphics.dll
Syntax
public class GlobalResolutionSetter : MonoBehaviour
Remarks
This script sets global rendering resolution based on the predefined settings inside scriptable object that is attached to the component with this script. This is needed for tests consistency. For example by the date of writing this new Android devices are added to the test rig, which have different resolution (2280x1080) compared to the old ones (1920x1080). This difference causes majority of tests fail.
Methods
SetResolution(RuntimePlatform, int, int, bool)
Sets rendering resolution.
Declaration
public static bool SetResolution(RuntimePlatform platformFilter, int width = 1920, int height = 1080, bool fullscreen = true)
Parameters
| Type | Name | Description |
|---|---|---|
| RuntimePlatform | platformFilter | Platform to set resolution for. |
| int | width | Width of the resolution. |
| int | height | Height of the resolution. |
| bool | fullscreen | Whether to set fullscreen or not. |
Returns
| Type | Description |
|---|---|
| bool | True if resolution was set, false otherwise. |
SetResolution(CustomResolutionFields)
Sets rendering resolution.
Declaration
public static bool SetResolution(CustomResolutionFields resolutionFields)
Parameters
| Type | Name | Description |
|---|---|---|
| CustomResolutionFields | resolutionFields | Resolution fields to set. |
Returns
| Type | Description |
|---|---|
| bool | True if resolution was set, false otherwise. |
SetResolutionWithRetry(int, int, bool, int)
Sets the screen resolution with retry and verification logic.
Declaration
public static IEnumerator SetResolutionWithRetry(int width, int height, bool fullscreen, int maxRetries = 3)
Parameters
| Type | Name | Description |
|---|---|---|
| int | width | Target width |
| int | height | Target height |
| bool | fullscreen | Fullscreen mode |
| int | maxRetries | Maximum number of retry attempts |
Returns
| Type | Description |
|---|---|
| IEnumerator | Coroutine enumerator |