Summary
[Editor-Only]
An
Weaver.Editor.Procedural.AssetGenerator which saves UnityEditor.MonoScripts as ".cs" text files.
- Assembly
- Weaver
.dll - Namespace
- Weaver
.Editor .Procedural - Base Types
-
- Object
- AssetGenerator
- TextGenerator
graph BT
Type-->Base0["TextGenerator"]
click Base0 "/weaver/api/Weaver.Editor.Procedural/TextGenerator"
Base0-->Base1["AssetGenerator"]
click Base1 "/weaver/api/Weaver.Editor.Procedural/AssetGenerator"
Base1-->Base2["Object"]
Type["ScriptGenerator"]
class Type type-node
Syntax
[AssetGenerator(typeof(MonoScript))]
public class ScriptGenerator : TextGenerator
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 |
.cs
|
| 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).
Inherited from TextGenerator
|
| Generator |
Type |
The default return type for generator methods used by this generator.
Inherited from TextGenerator
|
| HowToCancel | string |
Explains how to cancel the generation of an asset.
Inherited from TextGenerator
|
| SaveMessage | StringBuilder |
The contents of this
System.Text.StringBuilder will be logged and cleared once the current script finishes generating.static
|
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.Inherited from AssetGenerator
|
| AppendHeader |
void |
Appends "// This file was procedurally generated by ...".
|
| Destroy |
void |
Destroys the specified `obj`.
Inherited from AssetGenerator
|
| DisableSaveMessage |
void |
Prevents the "Generated Procedural Script: ..." message from being logged for the currently generating
script.
static
|
| Get |
string |
Gets the asset path of the existing asset and destroys all of its sub-assets.
Inherited from AssetGenerator
|
| GetGeneratorMethod |
MethodInfo |
Attempts to find the generator method assofiated with `assetField`.
Inherited from AssetGenerator
|
| GetGeneratorMethod |
MethodInfo |
Finds the generator method associated with a particular procedural asset.
Inherited from AssetGenerator
|
| GetMethod |
MethodInfo |
Finds the generator method associated with a particular procedural asset.
Inherited from AssetGenerator
|
| Invoke |
Object |
Invokes `asset.GeneratorMethod` with the correct parameters for this
Weaver.Editor.Procedural.AssetGenerator.
|
| LogRebuildReason |
void |
Adds the `reason` that the script at the specified `assetPath` should be rebuilt to the save message.
static
|
| OnSaveText |
void |
Logs the
Weaver.Editor.Procedural.ScriptGenerator.SaveMessage. |
| Save |
void |
Does nothing because
UnityEngine.TextAssets are saved inside Weaver.Editor.Procedural.TextGenerator.InvokeGeneratorMethod(Weaver.Editor.Procedural.ProceduralAsset).Inherited from TextGenerator
|
| SaveAndRelease |
void |
Writes the contents of the `text` to the specified file `path` and releases the
System.Text.StringBuilder for later reuse.
Inherited from TextGenerator
static
|
| SaveDefaultAsset |
void |
Creates and saves an empty default asset to save sub assets inside while the asset is still generating.
Inherited from AssetGenerator
|
| UseTempScene |
bool |
Indicates whether a temporary scene should be opened while generating the specified `asset`.
Default is false.
Inherited from AssetGenerator
|
| Validate |
bool |
Checks if return type of a generator method is valid for this generator type.
Inherited from AssetGenerator
|