docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class ImageComparisonSettings

    Settings to control how image comparison is performed by ImageAssert.

    Inheritance
    object
    ImageComparisonSettings
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: UnityEngine.TestTools.Graphics
    Assembly: UnityEngine.TestTools.Graphics.dll
    Syntax
    [Serializable]
    public class ImageComparisonSettings

    Fields

    ActiveImageTests

    Determines which tests are active when comparing the images. The tiled deltaE algorithm ignores this setting: it always evaluates the average and the tiles.

    Declaration
    [Tooltip("Determines which tests are active when comparing the images.")]
    public ImageComparisonSettings.ImageTests ActiveImageTests
    Field Value
    Type Description
    ImageComparisonSettings.ImageTests

    ActivePixelTests

    Determines which tests are active when determining whether an individual pixel is correct or not. An incorrect pixel will increase the counter associated with the IncorrectPixelsCount image test. This is only relevant when ActiveImageTests has the IncorrectPixelsCount flag set. The tiled deltaE algorithm ignores this setting.

    Declaration
    [Tooltip("Determines which tests affect the counter used by the IncorrectPixelsCount image test.")]
    public ImageComparisonSettings.PixelTests ActivePixelTests
    Field Value
    Type Description
    ImageComparisonSettings.PixelTests

    AverageCorrectnessThreshold

    The maximum permitted average error value across the entire image. If the average per-pixel difference across the image is above this value, the images are considered not to be equal.

    Declaration
    [Tooltip("The maximum permitted average error value across the entire image.")]
    public float AverageCorrectnessThreshold
    Field Value
    Type Description
    float

    ComparisonAlgorithm

    The algorithm ImageAssert.AreEqual uses to compare the rendered image with the reference image. It defaults to LegacyColorDifference, the zero value, so settings that do not store it run the legacy algorithm, which evaluates the tests selected by ActiveImageTests. TiledDeltaE always evaluates the average deltaE and the tiled deltaE, and ignores ActiveImageTests. ImageAssert.AreEqualLinearHDR runs none of these algorithms: it compares with its own statistics, and throws an ArgumentException for any value but the default.

    Declaration
    [Tooltip("The algorithm that compares the rendered image with the reference image. Tiled Delta E measures with the corrected deltaE formula; Legacy Color Difference measures with the original, which existing reference images were made with.")]
    public ComparisonAlgorithm ComparisonAlgorithm
    Field Value
    Type Description
    ComparisonAlgorithm

    IncorrectPixelsThreshold

    The maximum ratio of pixels allowed to be incorrect across the image. A pixel is incorrect if it exceeds the specified per-pixel thresholds. The tiled deltaE algorithm ignores this setting.

    Declaration
    [Tooltip("The maximum ratio of pixels allowed to be incorrect across the image.")]
    public float IncorrectPixelsThreshold
    Field Value
    Type Description
    float

    MaxTileDeltaEThreshold

    The maximum permitted average deltaE within any single tile. A negative value means the threshold has not been set, in which case AverageCorrectnessThreshold is used instead. Only the tiled deltaE algorithm reads this setting.

    Declaration
    [Tooltip("The maximum permitted average deltaE within any single tile. Negative means unset.")]
    public float MaxTileDeltaEThreshold
    Field Value
    Type Description
    float

    PerPixelAlphaThreshold

    The permitted difference between the alpha component of individual pixels of the images. The tiled deltaE algorithm ignores this setting.

    Declaration
    [Tooltip("The permitted difference between the alpha component of individual pixels of the images.")]
    public float PerPixelAlphaThreshold
    Field Value
    Type Description
    float

    PerPixelCorrectnessThreshold

    The permitted perceptual difference between individual pixels of the images.

    The deltaE for each pixel of the image is compared and any differences below this threshold are ignored.

    Declaration
    [Tooltip("The permitted perceptual difference between individual pixels of the images.")]
    public float PerPixelCorrectnessThreshold
    Field Value
    Type Description
    float

    PerPixelGammaThreshold

    The permitted difference between the RGB components (in gamma) of individual pixels of the images. The tiled deltaE algorithm ignores this setting.

    Declaration
    [Tooltip("The permitted difference between the RGB components (in gamma) of individual pixels of the images.")]
    public float PerPixelGammaThreshold
    Field Value
    Type Description
    float

    RMSEThreshold

    The maximum permitted root mean squared error value across the entire image. If the root mean squared per-pixel error across the image is above this value, the images are considered not to be equal. Neither comparison algorithm reads this setting; only ImageAssert.AreEqualLinearHDR does.

    Declaration
    [Tooltip("The maximum permitted root mean squared error value across the entire image.")]
    public float RMSEThreshold
    Field Value
    Type Description
    float

    TargetHeight

    The height to use for the rendered image. If a reference image already exists for this test and has a different size the test will fail.

    Declaration
    [Tooltip("The height to use for the rendered image.")]
    public int TargetHeight
    Field Value
    Type Description
    int

    TargetMSAASamples

    The sample count needed for the test scene to be compared

    Declaration
    public int TargetMSAASamples
    Field Value
    Type Description
    int

    TargetWidth

    The width to use for the rendered image. If a reference image already exists for this test and has a different size the test will fail.

    Declaration
    [Tooltip("The width to use for the rendered image.")]
    public int TargetWidth
    Field Value
    Type Description
    int

    TilesPerAxis

    The number of tiles along each axis. A value of 16 divides the image into a 16 by 16 grid, whatever its resolution. It is clamped to at least 1, and to the smaller image dimension so that no tile is empty. Only the tiled deltaE algorithm reads this setting.

    Declaration
    [Tooltip("The number of tiles along each axis the tiled deltaE algorithm divides the image into.")]
    public int TilesPerAxis
    Field Value
    Type Description
    int

    UseBackBuffer

    Use back buffer capture

    Declaration
    [Tooltip("If enabled, tests will use the back buffer, as opposed to a render texture.")]
    public bool UseBackBuffer
    Field Value
    Type Description
    bool

    UseHDR

    Use HDR rendering

    Declaration
    [Tooltip("If enabled, render textures will be created with DefaultHDR format.")]
    public bool UseHDR
    Field Value
    Type Description
    bool

    Properties

    ActualImageFileName

    The filename to use for the Actual Image. Use this to override the image filename.

    Declaration
    [Tooltip("Overrides the actual image filename when it is written to disk.")]
    public string ActualImageFileName { get; set; }
    Property Value
    Type Description
    string
    In This Article
    Back to top
    Copyright © 2026 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)