Hello folks,
I may easily have missed something basic, but I can’t for the life of me find anything resembling introductory material on how to get started with Editor Scripting.
In case anyone feels inclined to comment, I’ll say a little bit about what sort of things I’d like to do:
I would like to able to use parameters defined in a script somewhere to do batch operations on objects that exist, at edit time, in the scene. I would like to be able to do batch operations on prefabs. I would like to be able to provide hooks in the editor scripts to allow these actions to be invoked from vanilla classes that will also do things at runtime, and if possible, from monobehaviour scripts as well.
File 1: editor script with hooks
public class Editorial
{
public static void DefineGameObject( string name )
{
//magical code that creates an object in the current scene
}
public static int GetNumberOfPrefabs()
{
//mysterious code that gets the number of prefabs defined in the project
}
public static int GetNumberOfScripts()
{
//arcane incantations that divine the number of scripts defined in the project
}
}
File 2: vanilla class
public class Vanillial
{
private static readonly int numberOfPrefabs = Editorial.GetNumberOfPrefabs();
public Vanillial()
{
//joyous constructor code that uses this information in a meaningful way
}
}
File 3: Monobehaviour class
public class Monoial : MonoBehaviour
{
private static readonly int numberOfScripts = Editorial.GetNumberOfScripts();
public Monoial()
{
//victorious code that wins repeatedly
}
}
edit:
Totally meant to put this in scripting. Can I get a move? =/