Summary
[Editor-Only]
Base class for systems which manage aspects of procedural asset generation that are unique to certain asset
types: determining the asset path, finding and invoking the generator method, and saving the generated asset.
- Assembly
- Weaver
.dll - Namespace
- Weaver
.Editor .Procedural - Base Types
-
- Object
- Derived Types
graph BT
Type-->Base0["Object"]
Type["AssetGenerator"]
class Type type-node
Derived0["PrefabGenerator"]-->Type
click Derived0 "/weaver/api/Weaver.Editor.Procedural/PrefabGenerator"
Derived1["TextGenerator"]-->Type
click Derived1 "/weaver/api/Weaver.Editor.Procedural/TextGenerator"
Derived2["AssetListGenerator"]-->Type
click Derived2 "/weaver/api/Weaver.Editor.Procedural/AssetListGenerator"
Derived3["TextureGenerator"]-->Type
click Derived3 "/weaver/api/Weaver.Editor.Procedural/TextureGenerator"
Syntax
[AssetGenerator(typeof(Object))]
public class AssetGenerator
Attributes
| Type | Description |
|---|---|
| Asset |
[Editor-Only]
Specifies which asset type can be generated by the attributed class (which must inherit from
Weaver.Editor.Procedural.AssetGenerator).
|
Properties
| Name | Value | Summary |
|---|---|---|
| DefaultFileExtension | string |
.asset
|
| Generator |
Type[] |
The parameter types of a generator method for this asset type. When overriding this property, consider
using
Weaver.ReflectionUtilities.OneType(System.Type) or Weaver.ReflectionUtilities.TwoTypes(System.Type,System.Type).
|
| Generator |
Type |
The default return type for generator methods used by this generator.
|
| HowToCancel | string |
Explains how to cancel the generation of an asset (for
Weaver.Editor.Procedural.AssetGenerator.AppendFullDescription(System.Text.StringBuilder)). |
Methods
| Name | Value | Summary |
|---|---|---|
| AddItemsToMenu |
void |
Populates `menu` with various items for the context menu of `asset`.
|
| Append |
void |
Appends the full description of this
Weaver.Editor.Procedural.AssetGenerator and how it is to be used. |
| Destroy |
void |
Destroys the specified `obj`.
|
| Get |
string |
Gets the asset path of the existing asset and destroys all of its sub-assets.
|
| GetGeneratorMethod |
MethodInfo |
Attempts to find the generator method assofiated with `assetField`.
|
| GetGeneratorMethod |
MethodInfo |
Finds the generator method associated with a particular procedural asset.
|
| GetMethod |
MethodInfo |
Finds the generator method associated with a particular procedural asset.
|
| Invoke |
Object |
Invokes `asset.GeneratorMethod` with the correct parameters for this
Weaver.Editor.Procedural.AssetGenerator. |
| Save |
void |
Saves `obj` as an asset file at `assetPath`. If successful, the `obj` is destroyed and the reference is
replaced with the newly saved asset.
|
| SaveDefaultAsset |
void |
Creates and saves an empty default asset to save sub assets inside while the asset is still generating.
|
| UseTempScene |
bool |
Indicates whether a temporary scene should be opened while generating the specified `asset`.
Default is false.
|
| Validate |
bool |
Checks if return type of a generator method is valid for this generator type.
|