Class GraphicsTestBuildSettings
A class that holds settings for the Graphics Test Build.
Implements
Inherited Members
Namespace: UnityEngine.TestTools.Graphics
Assembly: UnityEngine.TestTools.Graphics.dll
Syntax
[Serializable]
[CreateAssetMenu(fileName = "GraphicsTestBuildSettings.asset", menuName = "Graphics Test Framework/Graphics Test Build Settings")]
public class GraphicsTestBuildSettings : ScriptableObject, ISerializationCallbackReceiver
Constructors
GraphicsTestBuildSettings()
Constructor for the GraphicsTestBuildSettings class.
Declaration
public GraphicsTestBuildSettings()
Fields
k_EnableShaderStrippingArgument
The CLI argument for enabling shader stripping. Used to override the EnableShaderStripping property.
Declaration
public const string k_EnableShaderStrippingArgument = "-enable-shader-stripping"
Field Value
| Type | Description |
|---|---|
| string |
k_OverrideIgnoreAttributesArgument
The CLI argument for overriding ignore attributes. Used to override the OverrideIgnoreAttributes property.
Declaration
public const string k_OverrideIgnoreAttributesArgument = "-override-ignore-attributes"
Field Value
| Type | Description |
|---|---|
| string |
k_SaveActualImagesArgument
The CLI argument for saving actual images. Used to override the SaveActualImages property.
Declaration
public const string k_SaveActualImagesArgument = "-save-actual-images"
Field Value
| Type | Description |
|---|---|
| string |
k_ShaderWarningsAsErrorsArgument
The CLI argument for shader warnings as errors. Used to override the ShaderWarningsAsErrors property.
Declaration
public const string k_ShaderWarningsAsErrorsArgument = "-shader-warnings-as-errors"
Field Value
| Type | Description |
|---|---|
| string |
Properties
ActualImagesPath
The resolved path for actual/result images. Falls back to
Assets/ActualImages when ImageResultsPath is empty.
Declaration
public string ActualImagesPath { get; }
Property Value
| Type | Description |
|---|---|
| string |
AutoBuildTestCases
A boolean that determines whether to automatically build test cases when building the player.
Declaration
public bool AutoBuildTestCases { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
This is used to automatically build test cases when launching a test run.
AutoOptimizeReferenceImages
Optimize your reference images automatically when adding, removing or editing reference image files.
Declaration
public bool AutoOptimizeReferenceImages { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
BuildPlatformNames
The names of the platforms used in the most recent build.
Declaration
public string[] BuildPlatformNames { get; set; }
Property Value
| Type | Description |
|---|---|
| string[] |
BuildPlatformSchemata
The platform schemata used in the most recent build.
Declaration
public PlatformSchema[] BuildPlatformSchemata { get; set; }
Property Value
| Type | Description |
|---|---|
| PlatformSchema[] |
EnableShaderStripping
Whether to enable shader stripping in the build.
Declaration
public bool EnableShaderStripping { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
HeatmapColorScheme
The color scheme to use for visualizing the divergence among reference images.
Declaration
public HeatmapColorScheme HeatmapColorScheme { get; set; }
Property Value
| Type | Description |
|---|---|
| HeatmapColorScheme |
ImageResultsPath
The path to the image results.
Declaration
public string ImageResultsPath { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
MaxConcurrentImageOptimizations
The maximum number of concurrent image optimizations that can be run at the same time.
Declaration
public int MaxConcurrentImageOptimizations { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
Remarks
This is useful for limiting the number of concurrent optimizations to avoid overwhelming the system.
OverrideIgnoreAttributes
Whether to save actual images when running tests, even if they pass.
Declaration
public bool OverrideIgnoreAttributes { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
PlatformSchemata
The platform schemata to use in this project.
Declaration
public PlatformSchema[] PlatformSchemata { get; set; }
Property Value
| Type | Description |
|---|---|
| PlatformSchema[] |
Remarks
The schemata are resolved in sequence, meaning that test cases that have their test assets found using one schema will be skipped by latter schemata. It is recommended to order the schemata in order of specificity or priority.
PreviousScenesEnabled
The enabled states of the previous scenes. Used to restore the previous scenes after the build.
Declaration
public bool[] PreviousScenesEnabled { get; set; }
Property Value
| Type | Description |
|---|---|
| bool[] |
PreviousScenesPaths
The paths to the previous scenes. Used to restore the previous scenes after the build.
Declaration
public string[] PreviousScenesPaths { get; set; }
Property Value
| Type | Description |
|---|---|
| string[] |
ReloadDomainWhenEditingTestSceneAssets
Whether to use a file system watcher to automatically track changes in SceneGraphicsTestCase scene directories and trigger a domain reload after each change.
Declaration
public bool ReloadDomainWhenEditingTestSceneAssets { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
SaveActualImages
Whether to save actual images when running tests, even if they pass.
Declaration
public bool SaveActualImages { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
SavePath
The path to the GraphicsTestBuildSettings asset.
Declaration
public string SavePath { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
ShaderWarningsAsErrors
When enabled, shader warnings detected during builds or test runs are treated as errors
and will fail the job. Opt-in via the -shader-warnings-as-errors CLI flag.
Declaration
public bool ShaderWarningsAsErrors { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
ShouldCleanUpAfterBuild
A boolean that determines whether to clean up the Editor state after the build.
Declaration
public bool ShouldCleanUpAfterBuild { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
TestContentBundlePaths
The paths to the test content bundles included in the build.
Declaration
public string[] TestContentBundlePaths { get; set; }
Property Value
| Type | Description |
|---|---|
| string[] |
Remarks
The test content bundles are used to load test assets for the tests.
Methods
Create()
Create a new GraphicsTestBuildSettings.
Declaration
public static GraphicsTestBuildSettings Create()
Returns
| Type | Description |
|---|---|
| GraphicsTestBuildSettings | The created GraphicsTestBuildSettings. |
Remarks
This method will create a new GraphicsTestBuildSettings and set the name to the file name without extension.
Load(string)
Load the GraphicsTestBuildSettings from disk.
Declaration
public static GraphicsTestBuildSettings Load(string loadPath)
Parameters
| Type | Name | Description |
|---|---|---|
| string | loadPath | Asset path (editor) or Resources-relative path (runtime). |
Returns
| Type | Description |
|---|---|
| GraphicsTestBuildSettings | The loaded settings, or |
LoadOrDefault()
Returns the cached settings instance, loading from disk or creating defaults if needed.
Declaration
public static GraphicsTestBuildSettings LoadOrDefault()
Returns
| Type | Description |
|---|---|
| GraphicsTestBuildSettings | The cached or newly loaded settings instance. |
OnAfterDeserialize()
Implement this callback to transform data back into runtime data types after an object is deserialized.
Declaration
public void OnAfterDeserialize()
OnBeforeSerialize()
Implement this callback to transform data into serializable data types immediately before an object is serialized.
Declaration
public void OnBeforeSerialize()
Save()
Save the GraphicsTestBuildSettings.
Declaration
public bool Save()
Returns
| Type | Description |
|---|---|
| bool | True if the save was successful, false otherwise. |
Remarks
This method will save the GraphicsTestBuildSettings to the specified path. If the path does not exist, it will create the directory. If the path exists, it will mark the asset as dirty and save it.