Interface ICGResourceLoader
- Namespace
- FluffyUnderware.Curvy.Generator
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
cgModuleCGModuleThe CGModule requesting the resource.
contextstringA 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
cgModuleCGModuleThe CGModule that owns the resource.
objComponentThe Component to destroy.
contextstringA context string that provides additional information for resource destruction. The meaning depends on the loader implementation.
killboolIf
true, the resource is permanently destroyed (e.g., viaObject.Destroy). Iffalse, the resource is returned to a pool for later reuse, when pooling is supported by the loader.