Table of Contents

Interface ICGResourceLoader

Interface for creating and destroying resources managed by the CurvyGenerator.

public interface ICGResourceLoader

Remarks

Each resource type used by the Curvy Generator (GameObjects, Meshes, Splines, Shapes) has a corresponding ICGResourceLoader implementation that knows how to instantiate and tear down instances of that type. Loaders register themselves with RegisterResourceLoader(string, ICGResourceLoader) at load time, and are then invoked automatically when CG modules request or release resources.

Methods

Create(CGModule, string)

Creates a new instance of the resource this loader is responsible for.

[NotNull]
Component Create(CGModule cgModule, string context)

Parameters

cgModule CGModule

The CGModule requesting the resource.

context string

A context string that provides additional information for resource creation. The meaning depends on the loader implementation.

Returns

Component

The newly created Component representing the resource. Must not be null.

Destroy(CGModule, Component, string, bool)

Destroys or recycles a previously created resource instance.

void Destroy(CGModule cgModule, Component obj, string context, bool kill)

Parameters

cgModule CGModule

The CGModule that owns the resource.

obj Component

The Component to destroy.

context string

A context string that provides additional information for resource destruction. The meaning depends on the loader implementation.

kill bool

If true, the resource is permanently destroyed (e.g., via Object.Destroy). If false, the resource is returned to a pool for later reuse, when pooling is supported by the loader.