docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class RequireTestDataAttribute

    Declares assets that a test fixture or method requires at run time on every platform. The build pipeline packs the declared assets into a content bundle for player builds, and the assets are available through TestData in the Editor and in players alike. Declarations that resolve to no assets fail the build; assets missing at run time fail the test.

    Inheritance
    object
    Attribute
    RequireTestDataAttribute
    Inherited Members
    Attribute.Equals(object)
    Attribute.GetCustomAttribute(Assembly, Type)
    Attribute.GetCustomAttribute(Assembly, Type, bool)
    Attribute.GetCustomAttribute(MemberInfo, Type)
    Attribute.GetCustomAttribute(MemberInfo, Type, bool)
    Attribute.GetCustomAttribute(Module, Type)
    Attribute.GetCustomAttribute(Module, Type, bool)
    Attribute.GetCustomAttribute(ParameterInfo, Type)
    Attribute.GetCustomAttribute(ParameterInfo, Type, bool)
    Attribute.GetCustomAttributes(Assembly)
    Attribute.GetCustomAttributes(Assembly, bool)
    Attribute.GetCustomAttributes(Assembly, Type)
    Attribute.GetCustomAttributes(Assembly, Type, bool)
    Attribute.GetCustomAttributes(MemberInfo)
    Attribute.GetCustomAttributes(MemberInfo, bool)
    Attribute.GetCustomAttributes(MemberInfo, Type)
    Attribute.GetCustomAttributes(MemberInfo, Type, bool)
    Attribute.GetCustomAttributes(Module)
    Attribute.GetCustomAttributes(Module, bool)
    Attribute.GetCustomAttributes(Module, Type)
    Attribute.GetCustomAttributes(Module, Type, bool)
    Attribute.GetCustomAttributes(ParameterInfo)
    Attribute.GetCustomAttributes(ParameterInfo, bool)
    Attribute.GetCustomAttributes(ParameterInfo, Type)
    Attribute.GetCustomAttributes(ParameterInfo, Type, bool)
    Attribute.GetHashCode()
    Attribute.IsDefaultAttribute()
    Attribute.IsDefined(Assembly, Type)
    Attribute.IsDefined(Assembly, Type, bool)
    Attribute.IsDefined(MemberInfo, Type)
    Attribute.IsDefined(MemberInfo, Type, bool)
    Attribute.IsDefined(Module, Type)
    Attribute.IsDefined(Module, Type, bool)
    Attribute.IsDefined(ParameterInfo, Type)
    Attribute.IsDefined(ParameterInfo, Type, bool)
    Attribute.Match(object)
    Attribute.TypeId
    object.Equals(object, object)
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: UnityEngine.TestTools.Graphics
    Assembly: UnityEngine.TestTools.Graphics.dll
    Syntax
    [AttributeUsage(AttributeTargets.Class|AttributeTargets.Method, AllowMultiple = true)]
    public class RequireTestDataAttribute : Attribute
    Remarks

    Subclass and override CreateDescriptor(Type) to supply a custom ITestDataDescriptor with programmatic asset enumeration or custom addressing.

    Examples

    [RequireTestData("ssao-testdata", "Assets/Scenes/500_SSAO/depth.exr", "Assets/Scenes/500_SSAO/*.json")] public class SSAOShaderTestCases

    Constructors

    RequireTestDataAttribute(string, params string[])

    Declares required test data assets packed into a bundle with the given logical name. Declarations sharing a bundle name, including declarations on different fixtures, are merged into one bundle. Asset paths support '' wildcards over one directory, e.g. "Assets/Scenes/500_SSAO/.json".

    Declaration
    public RequireTestDataAttribute(string bundleName, params string[] assetPaths)
    Parameters
    Type Name Description
    string bundleName

    The logical bundle name, or null to derive it from the declaring type.

    string[] assetPaths

    Asset paths or wildcard patterns to include.

    Properties

    AssetPaths

    The declared asset paths or wildcard patterns.

    Declaration
    public IReadOnlyList<string> AssetPaths { get; }
    Property Value
    Type Description
    IReadOnlyList<string>

    BundleName

    The logical bundle name, or null when the name is derived from the declaring type.

    Declaration
    public string BundleName { get; }
    Property Value
    Type Description
    string

    Methods

    CreateDescriptor(Type)

    Creates the ITestDataDescriptor for this declaration: by default a TestDataDescriptor over AssetPaths, with the bundle name defaulting to the lower-cased declaring type name.

    Declaration
    public virtual ITestDataDescriptor CreateDescriptor(Type declaringType)
    Parameters
    Type Name Description
    Type declaringType

    The type the attribute is declared on.

    Returns
    Type Description
    ITestDataDescriptor

    The descriptor describing the declared assets.

    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)