UnityEditor.Editor.CreateCachedEditor C# (CSharp) Method

CreateCachedEditor() public static method

public static CreateCachedEditor ( Object targetObject, Type editorType, Editor &previousEditor ) : void
targetObject Object
editorType System.Type
previousEditor Editor
return void
        public static void CreateCachedEditor(Object targetObject, Type editorType, ref Editor previousEditor)
        {
            if (((previousEditor == null) || (previousEditor.m_Targets.Length != 1)) || (previousEditor.m_Targets[0] != targetObject))
            {
                if (previousEditor != null)
                {
                    Object.DestroyImmediate(previousEditor);
                }
                previousEditor = CreateEditor(targetObject, editorType);
            }
        }

Usage Example

Ejemplo n.º 1
0
 public override void OnPreviewGUI(Rect position, GUIStyle style)
 {
     if (!this.ValidPreviewSetup())
     {
         GUILayout.BeginHorizontal(new GUILayoutOption[0]);
         GUILayout.FlexibleSpace();
         Color color = GUI.color;
         GUI.color = new Color(1f, 1f, 1f, 0.5f);
         GUILayout.Label("Reflection Probe not baked yet", new GUILayoutOption[0]);
         GUI.color = color;
         GUILayout.FlexibleSpace();
         GUILayout.EndHorizontal();
     }
     else
     {
         ReflectionProbe reflectionProbe = base.target as ReflectionProbe;
         if (reflectionProbe != null && reflectionProbe.texture != null && base.targets.Length == 1)
         {
             Editor cubemapEditor = this.m_CubemapEditor;
             Editor.CreateCachedEditor(reflectionProbe.texture, null, ref cubemapEditor);
             this.m_CubemapEditor = (cubemapEditor as TextureInspector);
         }
         if (this.m_CubemapEditor != null)
         {
             this.m_CubemapEditor.SetCubemapIntensity(this.GetProbeIntensity((ReflectionProbe)base.target));
             this.m_CubemapEditor.OnPreviewGUI(position, style);
         }
     }
 }
All Usage Examples Of UnityEditor.Editor::CreateCachedEditor