We don’t yet have support for custom shaders in the UI. What you can try is to render the texture with a Camera to a RenderTexture and display that in the Image.
+1 for Material/ShaderGUI support, is it even on the roadmap?
it seems to be coming in 2021.2. UI Roadmap - Q3 2020
I only see ShaderGraph-UI on that list. I’m not sure if that will include MaterialEditor and ShaderGUI for custom material editors.
I also need to draw the MaterialEditor in a custom inspector, but the only way I can do that is by using an
IMGUIContainer, like this:
public class ImGUIDefaultInspector : IMGUIContainer
{
private Editor editor;
private readonly Object objectToInspect;
public ImGUIDefaultInspector(Object obj)
{
objectToInspect = obj;
onGUIHandler = OnGuiHandler();
}
private Action OnGuiHandler()
{
return () =>
{
if (editor == null)
{
// TODO: For some unknown reason, this doesn't work as intended.
// Instead of rendering the inspector of the GameObject as it should,
// it renders the Debug version of the inspector.
editor = Editor.CreateEditor(objectToInspect);
}
editor.DrawDefaultInspector();
};
}
}
This works for every element except for materials. For materials it renders the debug version of the inspector. Am I doing something wrong?
Any help would be appreciated.
Thanks!
EDIT: Just found out that I can use an InspectorElement and it draws the Material Editor correctly.