docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class TextureComparisonAlgorithm

    Abstract base class for algorithms that compare two textures using a specified threshold.

    Inheritance
    object
    TextureComparisonAlgorithm
    EuclideanDistance
    LegacyColorDifferenceAlgorithm
    PeakSignalToNoiseRatio
    StructuralSimilarity
    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
    public abstract class TextureComparisonAlgorithm

    Constructors

    TextureComparisonAlgorithm()

    Initializes a new instance of the TextureComparisonAlgorithm class.

    Declaration
    protected TextureComparisonAlgorithm()

    TextureComparisonAlgorithm(ITextureComparisonSettings)

    Initializes a new instance of the TextureComparisonAlgorithm class with the specified threshold.

    Declaration
    protected TextureComparisonAlgorithm(ITextureComparisonSettings settings)
    Parameters
    Type Name Description
    ITextureComparisonSettings settings

    The threshold that determines how differences between images are evaluated.

    Properties

    Description

    Gets or sets the description of the algorithm, used when displaying assertion results.

    Declaration
    public string Description { get; protected init; }
    Property Value
    Type Description
    string

    Settings

    Gets the threshold used by the algorithm to measure the difference between images.

    Declaration
    protected ITextureComparisonSettings Settings { get; }
    Property Value
    Type Description
    ITextureComparisonSettings

    Methods

    Compare(Texture2D, Texture2D)

    Compares two textures synchronously.

    Declaration
    public abstract ITextureComparisonResult Compare(Texture2D expected, Texture2D actual)
    Parameters
    Type Name Description
    Texture2D expected

    The first texture to compare.

    Texture2D actual

    The second texture to compare.

    Returns
    Type Description
    ITextureComparisonResult

    A result object representing the outcome of the comparison.

    Compare(Texture2D[], Texture2D[])

    Compares two series of textures synchronously

    Declaration
    public abstract ITextureComparisonResult Compare(Texture2D[] expected, Texture2D[] actual)
    Parameters
    Type Name Description
    Texture2D[] expected

    The first texture to compare.

    Texture2D[] actual

    The second texture to compare.

    Returns
    Type Description
    ITextureComparisonResult

    A result object representing the outcome of the comparison.

    CompareAsync(Texture2D, Texture2D)

    Compares two textures asynchronously.

    Declaration
    public abstract Task<ITextureComparisonResult> CompareAsync(Texture2D expected, Texture2D actual)
    Parameters
    Type Name Description
    Texture2D expected

    The first texture to compare.

    Texture2D actual

    The second texture to compare.

    Returns
    Type Description
    Task<ITextureComparisonResult>

    A task that represents the asynchronous comparison operation. The task result contains a ITextureComparisonResult representing the outcome of the comparison.

    Evaluate(ITextureComparisonResult)

    Evaluates the result of a texture comparison.

    Declaration
    public abstract (object, bool) Evaluate(ITextureComparisonResult result)
    Parameters
    Type Name Description
    ITextureComparisonResult result

    The result of the comparison to evaluate.

    Returns
    Type Description
    (object, bool)

    A tuple containing an evaluation object (typically for reporting) and a boolean indicating whether the comparison passed.

    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)