I am working on an Editor script that uses a component script in the scene. I want to be able to use the same custom classes in both the Editor script and the component script in the scene. How can I use the same custom class in both of these scripts, without having to rewrite the class in both files?
You can place the code you need in both (in the editor script and in the component script) in a global class. Works fine.
This is the script for the global class:
using UnityEngine;
using System.Collections;
public class MyGlobalStuff
{
public static void Test()
{
Debug.Log("Test was called");
}
}
And you can access it inside a component and inside an editor script:
MyGlobalStuff.Test();
Nice idea, actually.