Class NameGenerator
Name Generator class. These can be created and configured in the editor. Certain components use these, and they can be assigned in the inspector.
Inherited Members
Namespace: Unity.Simulation
Assembly: Unity.Simulation.Core.dll
Syntax
[CreateAssetMenu(fileName = "NameGenerator", menuName = "Simulation/NameGenerator", order = 1)]
[Serializable]
public class NameGenerator : ScriptableObject
Constructors
NameGenerator()
Default constructor that populates starting with Directory, Filename, Extension.
Declaration
public NameGenerator()
NameGenerator(params NameComponent[])
Variable length constructor for adding components. var generator = new NameGenerator ( new DirectoryNameComponent(), new FileNameComponent(), new LabelNameComponent("LABEL"), new TimestampNameComponent(), new SequenceNameComponent(), new ExtensionNameComponent() );
Declaration
public NameGenerator(params NameComponent[] components)
Parameters
| Type | Name | Description |
|---|---|---|
| NameComponent[] | components | Variable length set of NameComponents to add to the NameGenerator. |
Fields
components
The ordered list of NameComponent items that will be applied to the path.
Declaration
[SerializeReference]
public List<NameComponent> components
Field Value
| Type | Description |
|---|---|
| List<NameComponent> |
Methods
Generate(string, bool)
Generate a new path from a base path.
Declaration
public string Generate(string path, bool modify = true)
Parameters
| Type | Name | Description |
|---|---|---|
| string | path | Base path used to generate a new path. |
| bool | modify | If false, the NameComponent will not modify its state. This is equivalent to Reset() followed by Generate(). |
Returns
| Type | Description |
|---|---|
| string | The path component generated by this NameComponent |
Insert(int, Type)
Insert a NameComponent into the ordered list.
Declaration
public void Insert(int index, Type type)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | Where in the ordered list to create a new NameComponent. |
| Type | type | Type of NameComponent to insert. |
Insert(int, NameComponent)
Insert a NameComponent into the ordered list.
Declaration
public void Insert(int index, NameComponent component)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | Where in the ordered list to create a new NameComponent. |
| NameComponent | component | The NameComponent to insert. |