Here is the snippet from the script that i have written. There is an error in the line testShader = EditorGUI.ObjectField (rect,“Calculate:”, testShader, (typeof (Shader)));
The error says “Assets/Editor/ShaderManager.cs(94,17): error CS0266: Cannot implicitly convert type UnityEngine.Object' to
UnityEngine.Shader’. An explicit conversion exists (are you missing a cast?)”
I have tried a lot of stuff to resolve but I failed to resolve it. So any help would be highly appreciated.
Shader testShader= new Shader ();
Rect rect = EditorGUILayout.GetControlRect ();
GUIContent cont = new GUIContent ("Select a shader");
rect = EditorGUI.PrefixLabel (rect, cont);
testShader = EditorGUI.ObjectField (rect,"Calculate:", testShader, (typeof (Shader)));
EditorGUI.BeginDisabledGroup (!testShader);
if(GUI.Button (EditorGUILayout.GetControlRect (), "Calculate!"))
Calculate ();
EditorGUI.EndDisabledGroup ();