// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
#if GT_USE_UGUI
using System;
using System.Collections.Generic;
using System.Reflection;
using UnityEditor;
using UnityEngine;
using UnityEngine.UI;
using UEditor = UnityEditor.Editor;
namespace Microsoft.MixedReality.GraphicsTools.Editor
{
///
/// Helper class to show warnings on canvas objects.
///
[CanEditMultipleObjects]
[CustomEditor(typeof(Canvas))]
public class CanvasInspector : UEditor
{
private readonly List materialsToFix = new List();
private readonly List graphicsToFix = new List();
private readonly List masksToFix = new List();
private Type canvasEditorType = null;
private UEditor internalEditor = null;
private Canvas canvas = null;
private bool isRootCanvas = false;
private bool showWarnings = true;
private void OnEnable()
{
canvasEditorType = Type.GetType("UnityEditor.CanvasEditor, UnityEditor");
if (canvasEditorType != null)
{
internalEditor = CreateEditor(targets, canvasEditorType);
canvas = target as Canvas;
isRootCanvas = canvas.transform.parent == null || canvas.transform.parent.GetComponentInParent