Custom Material Editor

I am trying to reproduce the build-in Material Editor GUI for one of my material and add some other data. I tried to use the one given in the Custom Material Editors Manual. Unfortunately it doesn’t look like the default Material Editor.

Here is the result with the Default and the Custom Material Editor.

Here is the problematic part of code I think.

float controlSize = 64;
EditorGUIUtility.LookLikeControls(Screen.width - controlSize - 20);

Hi,
The example posted on http://docs.unity3d.com/Manual/SL-CustomMaterialEditors.html at “How the default material editor works” section uses obsolete calls :

Assets/Editor/CustomMatInspector.cs(22,25): warning CS0618: UnityEditor.MaterialEditor.RangeProperty(string, string, float, float)' is obsolete: Use RangeProperty with MaterialProperty instead.’
Assets/Editor/CustomMatInspector.cs(29,25): warning CS0618: UnityEditor.MaterialEditor.FloatProperty(string, string)' is obsolete: Use FloatProperty with MaterialProperty instead.’
…and 4 more.

I can find no example on how to use the MaterialProperty and it is quite unfortunate because I will release soon a new set of toon shaders that could benefit from this feature.

Just stumbled across this and found the solution (at least to the overlapping texture fields). You need to replace the deprecated LookLikeControls code with this:

float controlSize = 64;
EditorGUIUtility.fieldWidth = controlSize;
EditorGUIUtility.labelWidth = Screen.width - controlSize - 20;

Standard Shader editor code is in builtin_shaders archive.
http://netstorage.unity3d.com/unity/5a2e8fe35a68/builtin_shaders-5.0.1f1.zip
You can get up to date version from:

It is in Editor/StandardShaderGUI.cs