Extending Curvy Splines

Curvy Splines offers a lot of ready-made scripts you can drop on your GameObjects and be happy. However, there always will be the one feature you or your game designers are missing. Knowing that we not just offer you the full source code of Curvy Splines, but designed many aspects with extensibility in mind.

Extending Curvy Splines can be complex, but that highly depends on what you're after. Sometimes you just need to create a custom controller and override a single function to add the feature you want while other extensions require a solid knowledge of Curvy Splines mechanics.

  • First, read the API Introduction
  • Second, you should read the docs and thoroughly examine the provided examples. If you get stuck, feel free to ask at the forum
  • Use the source, Luke! Examine classes that provide similar functionality and see how it's done!

Obviously, you shouldn't create any custom code inside Curvy Splines' main folders. In case of custom shape templates and CG modules you can leave the files where the corresponding wizard created them, but like with custom controllers, toolbar items etc. you can save them anywhere in your project.

Curvy Shapes offers a quick way of creating Spline Shapes. Of course you can add your own shape templates: Custom Shape Templates

Extending the Curvy Generator is the most sophisticated way to extend Curvy Splines, but the most fun part, too! Though not rocket science, you'll need a good understanding of the Generator internals to successfully write quality modules. A simple wizard will help you create a module's skeleton at Project's window→Create→Curvy→CG Module.

When creating custom CG modules, you might want to create custom Data Types.

Class overview

All CG data types inherit from CGData (namespace FluffyUnderware.Curvy.Generator):

CGData
├── CGShape
│   └── CGPath
│       └── CGVolume
├── CGBounds
│   ├── CGGameObject
│   └── CGVMesh
├── CGVSubMesh
└── CGSpots

Creating a custom data type

  1. Inherit from the most appropriate base (usually CGData or CGShape).
  2. If code stripping (IL2CPP builds) is a concern, add your type to link.xml.
  3. Decorate with [CGDataInfo(r, g, b)] to give your type a color in the graph UI.
  4. Perfer using pooled SubArray<T> for large arrays and free them in Dispose(bool).