Interface IAssetGenerator
IAssetGenerator is an interface to generate new asset from incoming asset. Subclass of IAssetGenerator must have CustomAssetGenerator attribute.
Namespace: UnityEngine.AssetGraph
Syntax
public interface IAssetGenerator
Methods
CanGenerateAsset(AssetReference)
Test if generator can generate new asset with given asset. NodeException should be thrown if there is any error that user should know about.
Declaration
bool CanGenerateAsset(AssetReference asset)
Parameters
Type | Name | Description |
---|---|---|
AssetReference | asset | Asset to examine if derivertive asset can be generated. |
Returns
Type | Description |
---|---|
Boolean |
|
GenerateAsset(AssetReference, String)
Generates the asset.
Declaration
bool GenerateAsset(AssetReference asset, string generateAssetPath)
Parameters
Type | Name | Description |
---|---|---|
AssetReference | asset | Asset to generate derivertive asset from. |
String | generateAssetPath | Path to save generated derivertive asset. |
Returns
Type | Description |
---|---|
Boolean |
|
GetAssetExtension(AssetReference)
Gets the asset extension of generating asset.
Declaration
string GetAssetExtension(AssetReference asset)
Parameters
Type | Name | Description |
---|---|---|
AssetReference | asset | The source asset to generate from. |
Returns
Type | Description |
---|---|
String | The extension in string format (e.g. ".png"). |
GetAssetType(AssetReference)
Gets the type of the asset. For type of assets that have associated importers, return type of Importer. Textures = TextureImporter, Audio = AudioImporter, Video = VideoClipImporter
Declaration
Type GetAssetType(AssetReference asset)
Parameters
Type | Name | Description |
---|---|---|
AssetReference | asset | The source asset to generate from. |
Returns
Type | Description |
---|---|
Type | The asset type. |
OnInspectorGUI(Action)
Draw Inspector GUI for this AssetGenerator.
Make sure to call onValueChanged
() when inspector values are modified.
It will save state of AssetGenerator object.
Declaration
void OnInspectorGUI(Action onValueChanged)
Parameters
Type | Name | Description |
---|---|---|
Action | onValueChanged | Action to call when inspector value changed. |
OnValidate()
Called when validating this prefabBuilder. NodeException should be thrown if this modifier is not ready to be used for building.
Declaration
void OnValidate()