Class TestContentBundle
Abstract class representing a content bundle for graphics tests. This class provides a base for loading and unloading content bundles,
Inherited Members
Namespace: UnityEngine.TestTools.Graphics
Assembly: UnityEngine.TestTools.Graphics.dll
Syntax
public abstract class TestContentBundle
Constructors
TestContentBundle(string)
Constructor for the TestContentBundle class. This constructor initializes the content bundle with the specified path. It extracts the name of the content bundle from the path and sets the priority based on the index in the name.
Declaration
protected TestContentBundle(string path)
Parameters
| Type | Name | Description |
|---|---|---|
| string | path | The path to the content bundle. |
Fields
m_LoadState
The current load state of the content bundle. This is used to track the loading state of the content bundle. It can be one of the values from the TestContentBundle.LoadState enumeration.
Declaration
protected TestContentBundle.LoadState m_LoadState
Field Value
| Type | Description |
|---|---|
| TestContentBundle.LoadState |
Properties
AlwaysReloadAssets
Whether to always reload assets from the content bundle.
Declaration
public virtual bool AlwaysReloadAssets { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Name
The name of the content bundle. This is used to identify the content bundle.
Declaration
public string Name { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Path
The path to the content bundle. This is used to locate the content bundle on disk.
Declaration
protected string Path { get; }
Property Value
| Type | Description |
|---|---|
| string |
Priority
The priority of the content bundle. This is used to determine the order in which content bundles are loaded. A higher priority value indicates that the content bundle should be loaded first.
Declaration
public int Priority { get; }
Property Value
| Type | Description |
|---|---|
| int |
State
The current load state of the content bundle. This is used to track the loading state of the content bundle. It can be one of the values from the TestContentBundle.LoadState enumeration.
Declaration
public TestContentBundle.LoadState State { get; }
Property Value
| Type | Description |
|---|---|
| TestContentBundle.LoadState |
Methods
AssetPath(string)
Gets the path to an asset within the content bundle. This method should be overridden in derived classes to provide the actual path logic.
Declaration
public virtual string AssetPath(string assetName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | assetName | The name of the asset to get the path for. |
Returns
| Type | Description |
|---|---|
| string | The path to the asset within the content bundle. |
ContainsAsset(string)
Checks if the content bundle contains an asset with the specified name. This method should be overridden in derived classes to provide the actual checking logic.
Declaration
public abstract bool ContainsAsset(string assetName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | assetName | The name of the asset to check for. |
Returns
| Type | Description |
|---|---|
| bool | True if the content bundle contains the asset with the specified name, false otherwise. |
LoadAsset<T>(string)
Loads an asset from the content bundle. This method should be overridden in derived classes to provide the actual loading logic.
Declaration
public abstract T LoadAsset<T>(string assetName) where T : Object
Parameters
| Type | Name | Description |
|---|---|---|
| string | assetName | The name of the asset to load. This name is used to locate the asset within the content bundle. |
Returns
| Type | Description |
|---|---|
| T | The loaded asset of type |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the asset to load. This type must derive from Object. |
LoadBundleAsync()
Asynchronously loads the content bundle. This method should be overridden in derived classes to provide the actual loading logic.
Declaration
public abstract Task LoadBundleAsync()
Returns
| Type | Description |
|---|---|
| Task | A task representing the asynchronous operation of loading the content bundle. |
Unload()
Unloads the content bundle. This method should be overridden in derived classes to provide the actual unloading logic.
Declaration
public abstract void Unload()
Events
OnBundleLoaded
Event that is triggered when the content bundle is loaded. This event is used to notify subscribers when the content bundle has been successfully loaded.
Declaration
public abstract event Action<TestContentBundle> OnBundleLoaded
Event Type
| Type | Description |
|---|---|
| Action<TestContentBundle> |
Remarks
This event is triggered when the content bundle is loaded. Subscribers can use this event to perform actions after the content bundle has been loaded.