Advertisement
romanilyin

Untitled

Mar 12th, 2024
883
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.85 KB | Gaming | 0 0
  1. using System;
  2. using System.Reflection;
  3. using UnityEditor;
  4. using UnityEditor.UI;
  5. using UnityEngine;
  6.  
  7. [CustomEditor(typeof(ScenarioView))]
  8. public class ScenarioViewInspector : ButtonEditor
  9. {
  10.     private static readonly Type type = typeof(ScenarioView);
  11.     public override void OnInspectorGUI()
  12.     {
  13.         //DrawDefaultInspector();
  14.         MyOnInspectorGUI();
  15.     }
  16.  
  17.     private void MyOnInspectorGUI()
  18.     {
  19.         serializedObject.Update();
  20.         base.OnInspectorGUI();
  21.  
  22.         var iterator = serializedObject.GetIterator();
  23.         iterator.Next(true);
  24.        
  25.         while (iterator.NextVisible(true))
  26.         {
  27.             if ((iterator.name != "m_Script") && (type.GetField(iterator.propertyPath, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.DeclaredOnly) != null))
  28.                 EditorGUILayout.PropertyField(iterator);
  29.         }
  30.         serializedObject.ApplyModifiedProperties();
  31.     }
  32. }
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement