Custom Material Editors in JavaScript

Hi

There’s a nice explanation and example how to do Custom Material Editors on the Help: https://docs.unity3d.com/Documentation/Components/SL-CustomMaterialEditors.html

Unfortunatly only with C#.

I’d like to do this in JavaScript. In particular how to define the class correctly.
So this code:

using UnityEditor;

public class CustomMaterialInspector : MaterialEditor {
	public override void OnInspectorGUI () {
		base.OnInspectorGUI ();
	}
}

In JS?

This should be a good starting point:

Thanks for the pointer Dantus. Got it to work. Had some troubles calling the base function. Now it seems to work:

class CustomMaterialInspector extends MaterialEditor {
	function OnInspectorGUI ()	{
		super.OnInspectorGUI();
	}
}

Next problem :frowning:

How do I get the Material that the custom Inspector is on?

Editor.target;

Throws an error. (An instance of type ‘UnityEditor.Editor’ is required to access non static member ‘target’.

Nevermind.

this.target;

is correct.