Table of Contents

Class CurvyGenerator

Curvy Generator component

[ExecuteAlways]
[AddComponentMenu("Curvy/Generator")]
[RequireComponent(typeof(PoolManager))]
public class CurvyGenerator : DTVersionedMonoBehaviour
Inheritance
Object
Component
Behaviour
MonoBehaviour
DTVersionedMonoBehaviour
CurvyGenerator

Fields

Modules

List of modules this Generator contains

[HideInInspector]
public List<CGModule> Modules

Field Value

List<CGModule>

Properties

AutoRefresh

Gets or sets whether to automatically call Refresh(bool) if necessary

public bool AutoRefresh { get; set; }

Property Value

bool

Destroying

Gets whether the Generator is about to get destroyed

public bool Destroying { get; }

Property Value

bool

IsInitialized

Gets whether the generator and all its dependencies are fully initialized

public bool IsInitialized { get; }

Property Value

bool

OnRefresh

Event raised after refreshing the Generator

public CurvyCGEvent OnRefresh { get; set; }

Property Value

CurvyCGEvent

PoolManager

Gets the PoolManager

public PoolManager PoolManager { get; }

Property Value

PoolManager

RefreshDelay

Gets or sets the minimum delay between two consecutive calls to Refresh(bool) in play mode. Expressed in milliseconds of real time

public int RefreshDelay { get; set; }

Property Value

int

RefreshDelayEditor

Gets or sets the minimum delay between two consecutive calls to Refresh(bool) in edit mode. Expressed in milliseconds of real time

public int RefreshDelayEditor { get; set; }

Property Value

int

Methods

AddModule(CGModule)

Adds an existing module. Will set the UniqueID of the module.

public void AddModule(CGModule module)

Parameters

module CGModule

The module, which needs to be a direct child of the generator

Exceptions

ArgumentNullException

module is null

ArgumentException

module is not a child of the generator

AddModule(Type)

Adds a new module

[NotNull]
public CGModule AddModule(Type type)

Parameters

type Type

type of the Module

Returns

CGModule

the new Module

AddModule<T>()

Adds a Module

public T AddModule<T>() where T : CGModule

Returns

T

the new Module

Type Parameters

T

type of the Module

ArrangeModules()

Auto-Arrange modules' graph canvas position In other words, this alligns the graph with the top left corner of the canvas. This does not modify the modules position relatively to each other

public void ArrangeModules()

Clear()

Clears the whole generator

public void Clear()

Create()

Creates a new GameObject with a CurvyGenerator attached

public static CurvyGenerator Create()

Returns

CurvyGenerator

the Generator component

DeleteAllOutputManagedResources(out bool)

Delete all the managed resources acting as an output. One example of this are the generated meshes by the CreateMesh module

public bool DeleteAllOutputManagedResources(out bool associatedPrefabWasModified)

Parameters

associatedPrefabWasModified bool

Is true if an associated prefab was modified to deleted the output resources from it too

Returns

bool

True if there were deleted resources

Remarks

Due to how the prefab system works, this method has to delete output from associated prefab assets too

Deletes a link between two modules in the generator.

public void DeleteLink(CGModuleLink link)

Parameters

link CGModuleLink

The link to be deleted.

Exceptions

InvalidOperationException

Thrown when the start or end module of the link is null.

DeleteModule(CGModule)

Deletes a module (same as PCGModule.Delete())

public void DeleteModule(CGModule module)

Parameters

module CGModule

a module

FindModules<T>(bool)

Find modules of a given type

public List<T> FindModules<T>(bool includeOnRequestProcessing) where T : CGModule

Parameters

includeOnRequestProcessing bool

whether to include IOnRequestProcessing modules

Returns

List<T>

a list of zero or more modules

Type Parameters

T

the module type

GetModule(int, bool)

Gets a module by ID, either including or excluding IOnRequestProcessing modules

[CanBeNull]
public CGModule GetModule(int moduleID, bool includeOnRequestProcessing)

Parameters

moduleID int

the ID of the module in question

includeOnRequestProcessing bool

whether to include IOnRequestProcessing modules

Returns

CGModule

GetModule(string, bool)

Gets a module by name, either including or excluding IOnRequestProcessing modules

public CGModule GetModule(string moduleName, bool includeOnRequestProcessing)

Parameters

moduleName string
includeOnRequestProcessing bool

Returns

CGModule

GetModuleUniqueID(CGModule)

Generates a unique ID for the given module.

public int GetModuleUniqueID(CGModule module)

Parameters

module CGModule

The CGModule object for which a unique ID is to be generated.

Returns

int

A unique ID for the provided module.

GetModuleUniqueName(CGModule)

Generates a unique name for the given module by appending an integer counter if necessary.

public string GetModuleUniqueName(CGModule module)

Parameters

module CGModule

The CGModule object for which a unique name is to be generated.

Returns

string

A unique name for the provided module.

GetModule<T>(int, bool)

Gets a module by ID, either including or excluding IOnRequestProcessing modules (Generic version)

public T GetModule<T>(int moduleID, bool includeOnRequestProcessing) where T : CGModule

Parameters

moduleID int

the ID of the module in question

includeOnRequestProcessing bool

whether to include IOnRequestProcessing modules

Returns

T

Type Parameters

T

type of the module

GetModule<T>(string, bool)

Gets a module by name, either including or excluding IOnRequestProcessing modules (Generic version)

public T GetModule<T>(string moduleName, bool includeOnRequestProcessing) where T : CGModule

Parameters

moduleName string

the ID of the module in question

includeOnRequestProcessing bool

whether to include IOnRequestProcessing modules

Returns

T

Type Parameters

T

type of the module

Initialize(bool)

Initializes the Generator

public void Initialize(bool force = false)

Parameters

force bool

true to force reinitialization

OnRefreshEvent(CurvyCGEventArgs)

protected CurvyCGEventArgs OnRefreshEvent(CurvyCGEventArgs e)

Parameters

e CurvyCGEventArgs

Returns

CurvyCGEventArgs

Refresh(bool)

Refreshes the Generator

public void Refresh(bool forceUpdate = false)

Parameters

forceUpdate bool

true to force a refresh of all modules

RemoveModule(CGModule)

Removes the specified module from the Modules list.

public void RemoveModule(CGModule module)

Parameters

module CGModule

The CGModule object to be removed.

ReorderModules()

Changes the modules' positions to make the graph easier to read.

public void ReorderModules()

TryAutoRefresh()

Will try to auto refresh the generator. Basically this calls Refresh(bool) if AutoRefresh is set and the refresh delays are respected

public void TryAutoRefresh()