Script-based extension

To be detected as an extension, your script must be placed a namespace which ends with “.PolarisExtension”, the recommended pattern is <Company>.<Package>.PolarisExtension.

To avoid compilation error, you should wrap the entire code file inside a #if POLARIS && UNITY_EDITOR and #endif block, which means it only getting compiled when Polaris is imported and user is working with the editor. For example:

#if POLARIS && UNITY_EDITOR
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using Pinwheel.Polaris;
using UnityEditor;
namespace Pinwheel.Polaris.PolarisExtension
{
public class LPTUnityTerrainToPolaris
{
//Define some functions
}
}
#endif

You also have to define some mandatory functions for the extension to work, they are:

public static string GetPublisherName() {}
public static string GetPackageName() {}
public static void OpenSupportLink() {}

These function must have exact the same name and signature as above, and return the appropriate value to display in the extension info section. If you failed to define them, the extension will not be detected!

There are some optional functions to provide additional information:

public static string GetDescription() {}
public static string GetVersion() {}
public static void OpenUserGuide() {}

The Extension System provide a default GUI for every extension, which display a vertical list of button corresponding to each function in the script, to expose your function to the GUI, append the function name with “PX_” prefix, and it should be static, have void return type and zero parameter. For example:

public static void PX_OpenConverter() {}

You can create a custom GUI by providing a function as below:

public static void OnGUI() {}

Your GUI block will be display right below the extension info section.