I have done this before, but I can’t find it again. I have a custom editor class, and I want to set the variables of the editor.
For example, check out killTex in the code below- this is a texture of a little red X that I use as an in-editor delete button (screenshot further below).
I can not for the life of me find out where I assigned that image to killTex. If I wanted, eg, to make it a green checkmark instead, where would I look for the linkage?
class NodeEditor extends Editor {
// this stuff makes the node deletion button pretty
var killTex:Texture;
var nullStyle:GUIStyle = new GUIStyle();
var bDim:int = 20;
var ScreenHeightCorrection:int = 38; //the fuck?
protected function deleteButton (pos:Vector3) :boolean {
pos = target.transform.TransformPoint( pos );
var bPos:Vector3 = sceneCam.WorldToScreenPoint(pos);
bPos.y = Screen.height - bPos.y - ScreenHeightCorrection;
bPos.y -= bDim + 2;
bPos.x += 2;
Handles.BeginGUI();
var del:boolean = GUI.Button( Rect(bPos.x, bPos.y, bDim, bDim), killTex, nullStyle );
Handles.EndGUI();
return del;
}
// note: SceneView is undocumented. If at any time in the future it breaks, we will all die horribly.
function get sceneCam () :Camera {
return SceneView.lastActiveSceneView.camera;
}
function OnInspectorGUI () {
DrawDefaultInspector();
}
function get owner () :NodeList {
return (target as NodeList);
}
}