I get the error Expression denotes a type', where a variable’, value' or method group’ was expected whenever I try to do this code:
mat = EditorGUILayout.ObjectField(mat, Material, true);
People say you use the ‘new’ keyword before it, but I couldn’t get it to work.
When using that code it has ANOTHER error. :( The error is: Cannot implicitly convert type
– zardini123UnityEngine.Object' toUnityEngine.Material'. An explicit conversion exists (are you missing a cast?) I defined the variable 'mat' as a Material at the beginning of the script.Oh wow thats a easy fix! Thanks a bunch!
– zardini123or mat = (Material)EditorGUILayout.ObjectField(mat, typeof(Material), true); using as Material, you would still have to check for nullity, prefix casting will crash if not possible. It depends what you are after.
– fafase