API Introduction

Curvy features a full-fledged API you can use to integrate Curvy into your projects. Remember, all Controllers and the whole editor API was written using Curvy's API, no private secrets at all!

The best way to explore Curvy's API is to browse the API reference or explore available properties and methods with intellisense right from Visual Studio or MonoDevelop.

Source code naming conventions

When working with the API you should keep in mind the following code conventions Curvy follows:

  • Methods ending with “Fast” means that Caching data is being used
  • Methods ending with “INTERNAL” should be considered private and generally not be used. The reason you're seeing them is that we need to access them from editor classes and there's no proper way in C# to hide them from you.
  • Properties usually don't need to be cached by you. Either they're cached internally or fast enough to call them multiple times. Costly operations always use functions - just in case you wonder why some features are properties while others are functions…

Before using the API

Curvy splines as well as the Curvy Generator are built from several GameObjects that needs to be properly initialized before you can access them savely.

Both components have a IsInitialized property that you should check before trying to interact with them:

IEnumerator Start ()
{
        if (Spline) 
        {
            // Wait until the spline is fully intialized before accessing it:
            while (!Spline.IsInitialized)
                yield return null;
            // now we're safe to use it
            Spline.Add();
        }
}

Preprocessor symbols

You can set global preprocessor defines to enable/disable several features.

CURVY_DEBUG

Collect debug informations (like Curvy Generator execution times) outside the editor and shows additional data in several places If set,

Last modified: 2015/09/23 12:12 by Jake