public override void OnMaterialPreviewGUI(MaterialEditor materialEditor, Rect r, GUIStyle background)
    {
        UnityEngine.Object[] targetMats = materialEditor.targets;

        //verify that there is at least one material in this list.
        if (targetMats == null || targetMats.Length < 1)
        {
            return;
        }

        Material firstMat = (Material)targetMats[0];

        if (m_previewMesh == null)
        {
            m_previewMesh = AssetDatabase.LoadAssetAtPath <Mesh>(kPreviewSpherePath);
        }

        m_previewUtility.BeginPreview(r, background);
        DREditorUtility.DrawPreview(m_previewUtility, firstMat, m_previewMesh, DREditorUtility.PreviewType.kStatic, m_scroll, ref m_rot);
        m_previewUtility.EndAndDrawPreview(r);

        // update Imported Object preview materials
        if (AssetDatabase.Contains(Selection.activeObject))
        {
            GameObject go = Selection.activeObject as GameObject;
            if (go != null)
            {
                Renderer[] renderers = go.GetComponentsInChildren <Renderer>();
                foreach (Renderer rdr in renderers)
                {
                    foreach (Material m in rdr.sharedMaterials)
                    {
                        // if the object is using a daydream material update the lights
                        if (m.shader.name.ToLower().Contains("daydream"))
                        {
                            DREditorUtility.SetPreviewProperties(m);
                        }
                    }
                }
            }
        }
    }
    public override void OnMaterialInteractivePreviewGUI(MaterialEditor materialEditor, Rect r, GUIStyle background)
    {
        UnityEngine.Object[] targetMats = materialEditor.targets;

        //verify that there is at least one material in this list.
        if (targetMats == null || targetMats.Length < 1)
        {
            return;
        }

        Material firstMat = (Material)targetMats[0];

        if (m_previewMesh == null)
        {
            m_previewMesh = AssetDatabase.LoadAssetAtPath <Mesh>(kPreviewSpherePath);
        }

        m_scroll = HandleInput(m_scroll, r);

        m_previewUtility.BeginPreview(r, background);
        DREditorUtility.DrawPreview(m_previewUtility, firstMat, m_previewMesh, DREditorUtility.PreviewType.kInteractive, m_scroll, ref m_rot);
        m_previewUtility.EndAndDrawPreview(r);
    }