Inheritance: UnityEngine.ScriptableObject, IPreviewable
コード例 #1
0
 protected void OnEditModeStart(Editor editor, UnityEditorInternal.EditMode.SceneViewEditMode mode)
 {
     if ((mode == UnityEditorInternal.EditMode.SceneViewEditMode.Collider) && (editor == this))
     {
         this.OnEditStart();
     }
 }
コード例 #2
0
    virtual public bool DrawMultiInstanceEditor(NPipeEditFlags flags, UnityEngine.Object[] objects)
    {
        UnityEditor.Editor editor = UnityEditor.Editor.CreateEditor(objects);
        bool changed = editor.DrawDefaultInspector();

        if ((flags & NPipeEditFlags.STORAGE_MODE) == NPipeEditFlags.STORAGE_MODE)
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label("Storage Mode");
            NPipeStorageMode newStorageMode = (NPipeStorageMode)GUILayout.Toolbar((int)storageMode, new string[] { "RAM", "RESOURCE_CACHE", "ATTACHED" });

            foreach (UnityEngine.Object o in objects)
            {
                if (((NPVoxProcessorBase <PRODUCT>)o).storageMode != storageMode)
                {
                    ((NPVoxProcessorBase <PRODUCT>)o).storageMode = newStorageMode;
                    changed = true;
                }
            }
            if (newStorageMode != storageMode)
            {
                this.storageMode = newStorageMode;
                changed          = true;
            }
            GUILayout.EndHorizontal();
            GUILayout.Space(2f);
        }

        return(changed);
    }
コード例 #3
0
 void OnGUI()
 {
     InspectorTools.DrawLogoAndName(InspectorTools.GetLogo(), "Loot manager v1.0.0");
     EditorGUILayout.BeginHorizontal();
     EditorGUILayout.BeginVertical(GUILayout.Width(130));
     ScrollElements = EditorGUILayout.BeginScrollView(ScrollElements);
     CurrentItem = InspectorTools.DrawButtonsByList<LootItem>(LootData.Instance.Items, (x) => { }, CurrentItem);
     EditorGUILayout.EndScrollView();
     EditorGUILayout.EndVertical();
     EditorGUILayout.BeginVertical();
     if (CurrentItem >= 0)
     {
         LootData.Instance.Items[CurrentItem].Image = EditorGUILayout.ObjectField("UI Image", LootData.Instance.Items[CurrentItem].Image, typeof(Sprite), GUILayout.MaxHeight(200)) as Sprite;
         LootData.Instance.Items[CurrentItem].Name = EditorGUILayout.TextField("Name", LootData.Instance.Items[CurrentItem].Name);
         LootData.Instance.Items[CurrentItem].Description = EditorGUILayout.TextField("Description", LootData.Instance.Items[CurrentItem].Description,GUILayout.MaxHeight(200));
         LootData.Instance.Items[CurrentItem].Prefab = EditorGUILayout.ObjectField("Prefab", LootData.Instance.Items[CurrentItem].Prefab, typeof(GameObject)) as GameObject;
         if (LootData.Instance.Items[CurrentItem].Prefab != null)
         {
             if (gameObjectEditor == null)
                 gameObjectEditor = Editor.CreateEditor(LootData.Instance.Items[CurrentItem].Prefab);
             gameObjectEditor.OnPreviewGUI(GUILayoutUtility.GetRect(300, 400), null);
         }
     }
     EditorGUILayout.EndVertical();
     EditorGUILayout.EndHorizontal();
     this.ChangeHotControllByClick();
 }
コード例 #4
0
        private static void InspectorHeaderFinished(UnityEditor.Editor editor)
        {
            string message = "";

            if (!IsOpenForEdit(AssetDatabase.GetAssetPath(editor.target), out message))
            {
                var enabled = GUI.enabled;
                GUI.enabled = true;
                GUILayout.BeginVertical();
                {
                    GUILayout.Space(9);
                    GUILayout.BeginHorizontal();
                    {
                        GUILayout.BeginVertical(GUILayout.Width(32));
                        {
                            GUILayout.Label(Utility.GetIcon("big-logo.png", "*****@*****.**", Utility.IsDarkTheme), GUILayout.Width(32), GUILayout.Height(32));
                        }
                        GUILayout.EndVertical();

                        GUILayout.BeginVertical();
                        {
                            GUILayout.Space(9);
                            GUILayout.Label(message, Styles.HeaderBranchLabelStyle);
                        }
                        GUILayout.EndVertical();
                    }
                    GUILayout.EndHorizontal();
                }
                GUILayout.EndVertical();
                GUI.enabled = enabled;
            }
        }
コード例 #5
0
    virtual public bool DrawMultiInstanceEditor(NPipeEditFlags flags, UnityEngine.Object[] objects)
    {
        UnityEditor.Editor editor = UnityEditor.Editor.CreateEditor(objects);
        bool changed = editor.DrawDefaultInspector();

        return(changed);
    }
コード例 #6
0
        public static SerializedProperty CheckFindProperty(this UnityEditor.Editor editor, string propertyName)
        {
            SerializedProperty result = editor.serializedObject.FindProperty(propertyName);

            Debug.Assert(result != null, "Missing property: " + propertyName);
            return(result);
        }
コード例 #7
0
        protected override void Awake()
        {
            base.Awake();

            temporaryVariantEditor = null;
            variant = ((ScriptableObjectVariant)assetTarget).Variant;
            variantSerializedObject = new SerializedObject(variant);

            if (variant != null)
            {
                EditorApplication.contextualPropertyMenu += ContextualPropertyMenu;

                temporaryVariant       = Instantiate(variant);
                temporaryVariantEditor = CreateEditor(temporaryVariant);
                MethodInfo beginProperty = typeof(EditorGUIUtility).GetMethod("add_beginProperty", BindingFlags.Static | BindingFlags.NonPublic);
                beginProperty.Invoke(null, new object[] { new Action <Rect, SerializedProperty>(BeginProperty) });

                string json = ((VariantImporter)target).Json;
                if (!string.IsNullOrEmpty(json))
                {
                    overrideData = JsonConvert.DeserializeObject <OverrideData>(json);
                }
                bound = true;
            }
            else
            {
                bound = false;
            }
        }
コード例 #8
0
        public static void AbstractPropertyDrawer(this SerializedProperty property)
        {
            if (property == null)
            {
                throw new ArgumentNullException("Null Property");
            }

            if (property.propertyType == SerializedPropertyType.ObjectReference)
            {
                if (property.objectReferenceValue == null)
                {
                    EditorGUILayout.PropertyField(property);
                    return;
                }

                System.Type        concreteType = property.objectReferenceValue.GetType();
                UnityEngine.Object castedObject = (UnityEngine.Object)System.Convert.ChangeType(property.objectReferenceValue, concreteType);

                UnityEditor.Editor editor = UnityEditor.Editor.CreateEditor(castedObject);

                editor.OnInspectorGUI();
            }
            else
            {
                EditorGUILayout.PropertyField(property);
            }
        }
コード例 #9
0
        void DrawBacktraceConfigSections()
        {
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(BacktraceIntegrationWindowLabels.LABEL_INTEGRATION_CONFIGSECTION_HEADER, BTEditorUtility.HeaderTextStyle);
            GUILayout.FlexibleSpace();

            backtraceConfiguration = (BacktraceConfiguration)EditorGUILayout
                                     .ObjectField(backtraceConfiguration, typeof(BacktraceConfiguration), false, new GUILayoutOption[]
            {
                GUILayout.MinWidth(position.width / 3)
            });

            EditorGUILayout.EndHorizontal();
            BTEditorUtility.DrawHorizontalUILine(Color.grey, 2, 1);
            if (backtraceConfiguration != null)
            {
                BTEditorUtility.DrawSubHeading("Settings for: " + backtraceConfiguration.name);

                if (backtraceConfigurationEditor == null)
                {
                    backtraceConfigurationEditor = UnityEditor.Editor.CreateEditor(backtraceConfiguration);
                }
                backtraceConfigurationEditor.OnInspectorGUI();
                backtraceConfigurationEditor.Repaint();
            }
            else
            {
                DrawConfigCreatorSection();
            }
        }
コード例 #10
0
 internal virtual void OnEnable()
 {
   this.m_ActiveEditorIndex = EditorPrefs.GetInt(this.GetType().Name + "ActiveEditorIndex", 0);
   if (!((UnityEngine.Object) this.m_ActiveEditor == (UnityEngine.Object) null))
     return;
   this.m_ActiveEditor = Editor.CreateEditor(this.targets, this.m_SubEditorTypes[this.m_ActiveEditorIndex]);
 }
コード例 #11
0
        /// <summary>
        /// Renders a non-editable object field and an editable dropdown of a profile.
        /// </summary>
        public static void RenderReadOnlyProfile(SerializedProperty property)
        {
            using (new EditorGUILayout.HorizontalScope())
            {
                EditorGUI.BeginDisabledGroup(true);
                EditorGUILayout.ObjectField(property.objectReferenceValue != null ? "" : property.displayName, property.objectReferenceValue, typeof(BaseMixedRealityProfile), false, GUILayout.ExpandWidth(true));
                EditorGUI.EndDisabledGroup();
            }

            if (property.objectReferenceValue != null)
            {
                bool showReadOnlyProfile = SessionState.GetBool(property.name + ".ReadOnlyProfile", false);

                using (new EditorGUI.IndentLevelScope())
                {
                    RenderFoldout(ref showReadOnlyProfile, property.displayName, () =>
                    {
                        using (new EditorGUI.IndentLevelScope())
                        {
                            UnityEditor.Editor subProfileEditor = CreateEditor(property.objectReferenceValue);
                            // If this is a default MRTK configuration profile, ask it to render as a sub-profile
                            if (typeof(BaseMixedRealityToolkitConfigurationProfileInspector).IsAssignableFrom(subProfileEditor.GetType()))
                            {
                                BaseMixedRealityToolkitConfigurationProfileInspector configProfile = (BaseMixedRealityToolkitConfigurationProfileInspector)subProfileEditor;
                                configProfile.RenderAsSubProfile = true;
                            }
                            subProfileEditor.OnInspectorGUI();
                        }
                    });
                }

                SessionState.SetBool(property.name + ".ReadOnlyProfile", showReadOnlyProfile);
            }
        }
コード例 #12
0
		private bool Init(UnityEngine.Object obj, EditorFeatures requirements)
		{
			this.editor = Editor.CreateEditor(obj);
			if (this.editor == null)
			{
				return false;
			}
			if ((requirements & EditorFeatures.PreviewGUI) > EditorFeatures.None && !this.editor.HasPreviewGUI())
			{
				return false;
			}
			Type type = this.editor.GetType();
			MethodInfo method = type.GetMethod("OnSceneDrag", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			if (method != null)
			{
				this.OnSceneDrag = (EditorWrapper.VoidDelegate)Delegate.CreateDelegate(typeof(EditorWrapper.VoidDelegate), this.editor, method);
			}
			else
			{
				if ((requirements & EditorFeatures.OnSceneDrag) > EditorFeatures.None)
				{
					return false;
				}
				this.OnSceneDrag = new EditorWrapper.VoidDelegate(this.DefaultOnSceneDrag);
			}
			return true;
		}
コード例 #13
0
		protected void OnEditModeStart(Editor editor, EditMode.SceneViewEditMode mode)
		{
			if (mode == EditMode.SceneViewEditMode.Collider && editor == this)
			{
				this.OnEditStart();
			}
		}
コード例 #14
0
        protected void CallInspectorMethod(string methodName, UnityEditor.Editor editor)
        {
            MethodInfo method = null;

            if (!decoratedMethods.ContainsKey(methodName))
            {
                const BindingFlags flags = BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public;

                method = decoratedEditorType.GetMethod(methodName, flags);

                if (method != null)
                {
                    decoratedMethods[methodName] = method;
                }
                else
                {
                    Debug.LogError(string.Format("Could not find method {0}", (MethodInfo)null));
                }
            }
            else
            {
                method = decoratedMethods[methodName];
            }

            if (method == null)
            {
                return;
            }

            method.Invoke(editor, EMPTY_ARRAY);
        }
コード例 #15
0
        private void OnScriptableObjectEditorGUI(SerializedProperty property)
        {
            UnityEditor.Editor editor = GetEditor(property.objectReferenceValue);

            if (m_Path == null)
            {
                m_Path     = AssetDatabase.GetAssetPath(property.objectReferenceValue);
                m_FileName = Path.GetFileNameWithoutExtension(m_Path);
            }

            Asset assetFile;
            bool  canEdit = CanEdit(m_Path, out assetFile);

            GUILayout.BeginHorizontal(Toolbar);

            GUI.enabled = canEdit;
            GUILayout.Label(m_FileName + " Inspector", ToolbarLabel, GUILayout.ExpandWidth(true));
            GUI.enabled = true;

            if (Provider.enabled && !canEdit && GUILayout.Button("Check Out", BoldToolbarButton, GUILayout.ExpandWidth(false)))
            {
                Provider.Checkout(assetFile, CheckoutMode.Both);
            }

            GUILayout.EndHorizontal();

            GUILayout.BeginVertical(SubEditorBox);
            using (new EditorGUI.DisabledGroupScope(Provider.enabled && !canEdit)) {
                editor.OnInspectorGUI();
            }

            GUILayout.EndVertical();
        }
コード例 #16
0
ファイル: EditMode.cs プロジェクト: demelev/projectHL
 public static void DoEditModeInspectorModeButton(SceneViewEditMode mode, string label, GUIContent icon, Bounds bounds, Editor caller)
 {
     if (!EditorUtility.IsPersistent(caller.target))
     {
         DetectMainToolChange();
         if (s_EditColliderButtonStyle == null)
         {
             s_EditColliderButtonStyle = new GUIStyle("Button");
             s_EditColliderButtonStyle.padding = new RectOffset(0, 0, 0, 0);
             s_EditColliderButtonStyle.margin = new RectOffset(0, 0, 0, 0);
         }
         Rect rect = EditorGUILayout.GetControlRect(true, 23f, new GUILayoutOption[0]);
         Rect position = new Rect(rect.xMin + EditorGUIUtility.labelWidth, rect.yMin, 33f, 23f);
         GUIContent content = new GUIContent(label);
         Vector2 vector = GUI.skin.label.CalcSize(content);
         Rect rect3 = new Rect(position.xMax + 5f, rect.yMin + ((rect.height - vector.y) * 0.5f), vector.x, rect.height);
         int instanceID = caller.GetInstanceID();
         bool flag = (editMode == mode) && (ownerID == instanceID);
         EditorGUI.BeginChangeCheck();
         bool flag2 = GUI.Toggle(position, flag, icon, s_EditColliderButtonStyle);
         GUI.Label(rect3, label);
         if (EditorGUI.EndChangeCheck())
         {
             ChangeEditMode(!flag2 ? SceneViewEditMode.None : mode, bounds, caller);
         }
     }
 }
コード例 #17
0
 public override void OnEnable()
 {
     LoadCollection();
     SetEditorSettings();
     LoadTree();
     modelViewerEditor = null;
 }
コード例 #18
0
        private void DrawEditor(SerializedProperty serializedProperty)
        {
            if (serializedProperty.objectReferenceValue != null)
            {
                if (m_editor == null || m_editor.target != serializedProperty.objectReferenceValue)
                {
                    m_editor = CreateEditor(serializedProperty.objectReferenceValue);
                }
            }
            else if (m_editor != null)
            {
                DestroyImmediate(m_editor);
            }

            if (m_editor != null)
            {
                serializedProperty.isExpanded = EditorGUILayout.InspectorTitlebar(serializedProperty.isExpanded, m_editor);

                if (serializedProperty.isExpanded)
                {
                    m_editor.OnInspectorGUI();
                }
            }
            else
            {
                EditorGUILayout.Space();
                EditorGUILayout.HelpBox("Select config asset to display.", MessageType.Info);
            }
        }
コード例 #19
0
        public void DrawFields(ExperienceProfile profile, string name)
        {
            EditorGUILayout.BeginHorizontal();
            {
                GUILayout.Label(name, GUILayout.Width(Screen.width * 0.2F));
            }
            EditorGUILayout.EndHorizontal();

            _scrollPos = EditorGUILayout.BeginScrollView(_scrollPos);

            var tmpEditor = UnityEditor.Editor.CreateEditor(profile);

            if (_currentConfigEditor != null)
            {
                Object.DestroyImmediate(_currentConfigEditor);
            }

            _currentConfigEditor = tmpEditor;

            if (_currentConfigEditor != null && _limappConfig != null)
            {
                _currentConfigEditor.OnInspectorGUI();
            }

            EditorGUILayout.EndScrollView();
        }
コード例 #20
0
        private static void InvokeMethods(UnityEditor.Editor editor, IEnumerable <MethodInfo> methods,
                                          Func <UnityEngine.Object, object> getTargetObject)
        {
            foreach (var method in methods)
            {
                // Get the ButtonAttribute on the method (if any)
                var ba = (ButtonAttribute)Attribute.GetCustomAttribute(method, typeof(ButtonAttribute));

                if (ba != null)
                {
                    // Determine whether the button should be enabled based on its mode
                    GUI.enabled = ba.Mode == ButtonMode.AlwaysEnabled
                                  ||
                                  (EditorApplication.isPlaying
                                      ? ba.Mode == ButtonMode.EnabledInPlayMode
                                      : ba.Mode == ButtonMode.DisabledInPlayMode);

                    // Draw a button which invokes the method
                    string buttonName = string.IsNullOrEmpty(ba.Name)
                        ? ObjectNames.NicifyVariableName(method.Name)
                        : ba.Name;
                    if (GUILayout.Button(buttonName))
                    {
                        foreach (var t in editor.targets)
                        {
                            var obj = getTargetObject(t);
                            method.Invoke(obj, null);
                        }
                    }

                    GUI.enabled = true;
                }
            }
        }
コード例 #21
0
        public static bool DrawDefaultInspectorWithoutScriptField(this UnityEditor.Editor _inspector)
        {
            EditorGUI.BeginChangeCheck();

            _inspector.serializedObject.Update();

            SerializedProperty Iterator = _inspector.serializedObject.GetIterator();

            Iterator.NextVisible(true);

            while (Iterator.NextVisible(false))
            {
                                #if FLOWREACTOR_DEBUG
                EditorGUILayout.PropertyField(Iterator, true);
                                #else
                if (!Iterator.type.Contains("FR"))
                {
                    EditorGUILayout.PropertyField(Iterator, true);
                }
                                #endif
            }

            _inspector.serializedObject.ApplyModifiedProperties();

            return(EditorGUI.EndChangeCheck());
        }
コード例 #22
0
        protected virtual void OnEnable()
        {
            _transform = target as Transform;

            // use default inspector. we do that when no vpe components are selected.
            var useDefault = true;

            // loop through selected objects
            foreach (var t in targets)
            {
                var itemTransform = t as Transform;
                if (!itemTransform)
                {
                    continue;
                }

                var item              = itemTransform.GetComponent <IMainRenderableComponent>();
                var isRenderableItem  = item != null;
                var overrideTransform = isRenderableItem && item.OverrideTransform;
                _itemSelected = itemTransform.GetComponent <IMainComponent>() != null;
                useDefault    = useDefault && (!_itemSelected || !overrideTransform) && itemTransform.GetComponent <IMeshComponent>() == null;

                // must be main but not the table itself
                if (isRenderableItem && item is not TableComponent)
                {
                    if (_primaryItem == null)
                    {
                        _primaryItem  = item;
                        _positionType = item.EditorPositionType;
                        _rotationType = item.EditorRotationType;
                        _scaleType    = item.EditorScaleType;
                    }
                    else
                    {
                        // only transform on axes supported by all
                        if (item.EditorPositionType < _positionType)
                        {
                            _positionType = item.EditorPositionType;
                        }
                        if (item.EditorRotationType < _rotationType)
                        {
                            _rotationType = item.EditorRotationType;
                        }
                        if (item.EditorScaleType < _scaleType)
                        {
                            _scaleType = item.EditorScaleType;
                        }
                        _secondaryItems.Add(new SecondaryItem {
                            Transform = t as Transform,
                            Item      = item,
                            Offset    = item.GetEditorPosition() - _primaryItem.GetEditorPosition(),
                        });
                    }
                }
            }
            if (useDefault)
            {
                _defaultEditor = CreateEditor(targets, Type.GetType("UnityEditor.TransformInspector, UnityEditor"));
            }
        }
コード例 #23
0
 private void GetEmbededEditor()
 {
     if (embededEditor == null)
     {
         embededEditor = UnityEditor.Editor.CreateEditor(Repository);
     }
 }
コード例 #24
0
    virtual public bool DrawInspector(NPipeEditFlags flags)
    {
        UnityEditor.Editor editor = UnityEditor.Editor.CreateEditor(this);
        bool changed = editor.DrawDefaultInspector();

        if ((flags & NPipeEditFlags.INPUT) == NPipeEditFlags.INPUT)
        {
            SOURCE_FACTORY newSource = NPipelineUtils.DrawSourceSelector <SOURCE_FACTORY>("Input", input as SOURCE_FACTORY);
            if (newSource as  NPVoxForwarderBase <SOURCE_FACTORY, PRODUCT> == this)
            {
                return(false);
            }
            changed = newSource != Input || changed;
            Input   = (NPipeIImportable)newSource;
        }

        // if((flags & NPVoxEditFlags.TOOLS) == NPVoxEditFlags.TOOLS)
        // {
        //     if(GUILayout.Button("Invalidate & Reimport Mesh Output Deep"))
        //     {
        //         NPVoxPipelineUtils.InvalidateAndReimportDeep( this );
        //     }
        // }

        return(changed);
    }
コード例 #25
0
            public void OnGUI()
            {
                if (mat == null || mat.Material == null)
                {
                    return;
                }

                IsOpen = EditorGUILayout.Foldout(IsOpen, mat.Material.name);

                if (IsOpen && Editor == null)
                {
                    Editor = UnityEditor.Editor.CreateEditor(mat.Material, typeof(MaterialEditor));
                }

                if (!IsOpen && Editor != null)
                {
                    Destroy();
                    return;
                }

                if (IsOpen)
                {
                    EditorGUILayout.LabelField(mat.Material.shader.name);

                    Editor.OnInteractivePreviewGUI(
                        GUILayoutUtility.GetRect(EditorGUIUtility.currentViewWidth - 32, 128), EditorStyles.helpBox);
                }
            }
コード例 #26
0
        // padding

        private void OnGUI()
        {
            // Try to create the editor object if it hasn't been initialized.
            if (editor == null)
            {
                editor = UnityEditor.Editor.CreateEditor(EM_Settings.Instance);
            }

            // If it's still null.
            if (editor == null)
            {
                EditorGUILayout.HelpBox("Coundn't create the settings resources editor.", MessageType.Error);
                return;
            }

            EM_SettingsEditor.callFromEditorWindow = true;
            EM_SettingsEditor.width  = position.width;
            EM_SettingsEditor.height = position.height;

            editor.DrawHeader();

            scrollPos = EditorGUILayout.BeginScrollView(scrollPos);
            EditorGUILayout.BeginVertical(new GUIStyle()
            {
                padding = new RectOffset(left, right, top, bottom)
            });

            editor.OnInspectorGUI();

            EditorGUILayout.EndVertical();
            EditorGUILayout.EndScrollView();

            EM_SettingsEditor.callFromEditorWindow = false;
        }
コード例 #27
0
    private void DrawTileEditor()
    {
        if (viewModel.CurrentPrefab != null)
        {
            GUILayout.Label("Tile Settings: " + viewModel.CurrentPrefabPath);
            GNBlockMapTile tile = viewModel.CurrentPrefab.GetComponent <GNBlockMapTile>();
            if (tile)
            {
                UnityEditor.Editor editor = UnityEditor.Editor.CreateEditor(tile);
                bool changed = editor.DrawDefaultInspector();
                if (changed)
                {
                    // blubb
                }
                if (GUILayout.Button("Delete Tile Component in current Prefab"))
                {
                    Undo.DestroyObjectImmediate(viewModel.CurrentPrefab.GetComponent <GNBlockMapTile>());
//                    Repaint();
                }
            }
            else
            {
                if (GUILayout.Button("Create Tile Component in current Prefab"))
                {
                    GNBlockMapTile tile2 = viewModel.CurrentPrefab.AddComponent <GNBlockMapTile>();
                    Undo.RegisterCreatedObjectUndo(tile2, "Painted an Object");
//                    Repaint();
//                    EditorUtility.SetDirty(viewModel.CurrentPrefab);
                }
            }
        }
    }
        void UpdateRigEditor()
        {
            var selectedRig = GetSelectedRig(Target);
            CinemachineVirtualCamera rig = Target.GetRig(selectedRig);

            if (m_EditedRig != rig || m_rigEditor == null)
            {
                m_EditedRig           = rig;
                m_RigEditorOnSceneGUI = null;
                if (m_rigEditor != null)
                {
                    UnityEngine.Object.DestroyImmediate(m_rigEditor);
                    m_rigEditor = null;
                }
                if (rig != null)
                {
                    CreateCachedEditor(rig, null, ref m_rigEditor);
                    if (m_rigEditor != null)
                    {
                        m_RigEditorOnSceneGUI = m_rigEditor.GetType().GetMethod("OnSceneGUI",
                                                                                System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
                    }
                }
            }
        }
コード例 #29
0
        public static void DrawEasyButtons(this UnityEditor.Editor editor)
        {
            // Loop through all methods with no parameters
            var methods = editor.target.GetType()
                          .GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)
                          .Where(m => m.GetParameters().Length == 0);

            foreach (var method in methods)
            {
                // Get the ButtonAttribute on the method (if any)
                var ba = (ButtonAttribute)Attribute.GetCustomAttribute(method, typeof(ButtonAttribute));

                if (ba != null)
                {
                    // Determine whether the button should be enabled based on its mode
                    GUI.enabled = ba.Mode == ButtonMode.AlwaysEnabled ||
                                  (EditorApplication.isPlaying ? ba.Mode == ButtonMode.EnabledInPlayMode : ba.Mode == ButtonMode.DisabledInPlayMode);

                    // Draw a button which invokes the method
                    var buttonName = String.IsNullOrEmpty(ba.Name) ? ObjectNames.NicifyVariableName(method.Name) : ba.Name;
                    if (GUILayout.Button(buttonName))
                    {
                        foreach (var t in editor.targets)
                        {
                            method.Invoke(t, null);
                        }
                    }

                    GUI.enabled = true;
                }
            }
        }
コード例 #30
0
		protected void OnEditModeEnd(Editor editor)
		{
			if (editor == this)
			{
				this.OnEditEnd();
			}
		}
        /// <summary>
        /// Renders a non-editable object field and an editable dropdown of a profile.
        /// </summary>
        /// <param name="property"></param>
        /// <returns></returns>
        public static void RenderReadOnlyProfile(SerializedProperty property)
        {
            EditorGUILayout.BeginHorizontal();

            EditorGUI.BeginDisabledGroup(true);
            EditorGUILayout.ObjectField(property.objectReferenceValue != null ? "" : property.displayName, property.objectReferenceValue, typeof(BaseMixedRealityProfile), false, GUILayout.ExpandWidth(true));
            EditorGUI.EndDisabledGroup();

            EditorGUILayout.EndHorizontal();

            if (property.objectReferenceValue != null)
            {
                UnityEditor.Editor subProfileEditor = UnityEditor.Editor.CreateEditor(property.objectReferenceValue);

                // If this is a default MRTK configuration profile, ask it to render as a sub-profile
                if (typeof(BaseMixedRealityToolkitConfigurationProfileInspector).IsAssignableFrom(subProfileEditor.GetType()))
                {
                    BaseMixedRealityToolkitConfigurationProfileInspector configProfile = (BaseMixedRealityToolkitConfigurationProfileInspector)subProfileEditor;
                    configProfile.RenderAsSubProfile = true;
                }

                EditorGUILayout.BeginHorizontal();
                EditorGUI.indentLevel++;
                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                subProfileEditor.OnInspectorGUI();
                EditorGUILayout.Space();
                EditorGUILayout.EndVertical();
                EditorGUI.indentLevel--;
                EditorGUILayout.EndHorizontal();
            }
        }
コード例 #32
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            int newIndex = EditorGUILayout.Popup("Setting", index, subTypeDisplayedOptions);

            if (newIndex != index)
            {
                index = newIndex;
                Undo.DestroyObjectImmediate(setting.objectReferenceValue);
                setting.objectReferenceValue = CreateInstance(subTypes[index]);
                settingEditor = CreateEditor(setting.objectReferenceValue);

                //var undoGroup = Undo.GetCurrentGroupName();
                //UnityEngine.Debug.Log(Undo.GetCurrentGroupName());

                //Undo.RecordObject(settingEditor, undoGroup);
                //setting.objectReferenceValue = CreateInstance(subTypes[index]);

                //Undo.IncrementCurrentGroup();
                //settingEditor = CreateEditor(setting.objectReferenceValue);
                //Undo.RevertAllInCurrentGroup();

                //Undo.ClearUndo(settingEditor);
                //Undo.RegisterCreatedObjectUndo(settingEditor, undoGroup);
            }

            settingEditor.OnInspectorGUI();

            serializedObject.ApplyModifiedProperties();
        }
コード例 #33
0
        private void OnEnable()
        {
            m_asset = (SDFMeshAsset)target;

            m_sourceMeshPreview = UnityEditor.Editor.CreateEditor(m_asset.SourceMesh);
            m_properties        = new SerializedProperties(serializedObject);
        }
コード例 #34
0
        public ScriptableObjectDrawer(GenericInspector inspector, Object target,
                                      SerializedObject serializedObject) :
            base(inspector, target, serializedObject)
        {
            var propertyIterator = serializedObject.GetIterator();

            while (propertyIterator.NextVisible(true))
            {
                if (propertyIterator.propertyType != SerializedPropertyType.ObjectReference)
                {
                    continue;
                }

                var propertyType = propertyIterator.GetFieldType();
                if (propertyType == null || !propertyType.IsSubclassOf(typeof(ScriptableObject)))
                {
                    continue;
                }

                UnityEditor.Editor scriptableEditor = null;

                if (propertyIterator.objectReferenceValue != null)
                {
                    UnityEditor.Editor.CreateCachedEditorWithContext(propertyIterator.objectReferenceValue,
                                                                     serializedObject.targetObject, typeof(GenericInspector),
                                                                     ref scriptableEditor);
                }

                _scriptableObjects.Add(propertyIterator.propertyPath, scriptableEditor as GenericInspector);
            }
        }
コード例 #35
0
        public override void OnInspectorGUI()
        {
            // Show the Spawner picker
            var newSpawner = (MultiSpawner)EditorGUILayout.ObjectField(
                new GUIContent("Graph Spawner"),
                _arranger.GraphSpawner,
                typeof(MultiSpawner),
                allowSceneObjects: true);

            if (newSpawner == null && _arranger.GraphSpawner != null)
            {
                DestroyImmediate(_spawnerEditor);
            }
            _arranger.GraphSpawner = newSpawner;

            // Show the Spawner inspector right in this Inspector
            if (_spawnerEditor == null && _arranger.GraphSpawner != null)
            {
                _spawnerEditor = CreateEditor(_arranger.GraphSpawner);
            }
            if (_spawnerEditor != null)
            {
                _spawnerEditor.DrawDefaultInspector();
                EditorGUILayout.Space();
            }

            DrawDefaultInspector();

            // Draw buttons
            EditorGUILayout.Space();
            if (GUILayout.Button($"Reset Nodes"))
            {
                _arranger.ResetNodes();
            }
        }
コード例 #36
0
 internal static void ApplyModifiedProperties(UnityEditor.Editor mainEditor)
 {
     if (mainEditor.serializedObject.hasModifiedProperties)
     {
         mainEditor.serializedObject.ApplyModifiedProperties();
     }
 }
コード例 #37
0
 /// <summary>
 /// Create in OnEnable()
 /// </summary>
 public EmbeddeAssetEditor(string propertyName, UnityEditor.Editor owner)
 {
     m_PropertyName           = propertyName;
     m_Owner                  = owner;
     m_CreateButtonGUIContent = new GUIContent(
         "Create Asset", "Create a new shared settings asset");
 }
コード例 #38
0
 internal virtual void OnEnable()
 {
     this.m_ActiveEditorIndex = EditorPrefs.GetInt(base.GetType().Name + "ActiveEditorIndex", 0);
     if (this.m_ActiveEditor == null)
     {
         this.m_ActiveEditor = Editor.CreateEditor(base.targets, this.m_SubEditorTypes[this.m_ActiveEditorIndex]);
     }
 }
コード例 #39
0
ファイル: HOGUIDrag.cs プロジェクト: fergu00/hounitylibs
 /// <summary>
 /// Starts a drag operation on a GUI element.
 /// </summary>
 /// <param name="editorWindow">Reference to the current editor drawing the GUI (used when a Repaint is needed)</param>
 /// <param name="draggableList">List containing the dragged item and all other relative draggable items</param>
 /// <param name="dragItem">Item being dragged</param>
 /// <param name="draggedItemIndex">DraggableList index of the item being dragged</param>
 /// <param name="optionalData">Optional data that can be retrieved via the <see cref="optionalDragData"/> static property</param>
 public static void StartDrag(EditorWindow editorWindow, IList draggableList, object dragItem, int draggedItemIndex, object optionalData = null)
 {
     if (_dragData != null) return;
     Reset();
     _editor = null;
     _editorWindow = editorWindow;
     _dragData = new GUIDragData(draggableList, dragItem, draggedItemIndex, optionalData);
 }
コード例 #40
0
		public static void DrawInspector(Editor wcEditor, System.Type baseType, List<string> ignoreClasses = null) {

			var so = new SerializedObject(wcEditor.targets);
			var target = wcEditor.target;
			
			so.Update();

			var baseTypes = new List<System.Type>();
			var baseTargetType = target.GetType();
			baseTypes.Add(baseTargetType);
			while (baseType != baseTargetType) {

				baseTargetType = baseTargetType.BaseType;
				baseTypes.Add(baseTargetType);

			}
			baseTypes.Reverse();

			SerializedProperty prop = so.GetIterator();
			var result = prop.NextVisible(true);

			EditorGUILayout.PropertyField(prop, false);

			if (result == true) {

				var currentType = EditorUtilitiesEx.FindTypeByProperty(baseTypes, prop);
				EditorGUILayout.BeginVertical();
				{

					while (prop.NextVisible(false) == true) {
						
						var cType = EditorUtilitiesEx.FindTypeByProperty(baseTypes, prop);
						if (cType != currentType) {
							
							currentType = cType;

							var name = cType.Name;
							if (ignoreClasses != null && ignoreClasses.Contains(name) == true) continue;

							EditorUtilitiesEx.DrawSplitter(name);

						}

						EditorGUILayout.PropertyField(prop, true);

					}

					prop.Reset();

				}
				EditorGUILayout.EndVertical();

			}

			so.ApplyModifiedProperties();

		}
コード例 #41
0
 void OnGUI()
 {
     if (serverConfig != null) {
        if (serverConfigEditor == null) {
             serverConfigEditor = Editor.CreateEditor(serverConfig);
         }
         serverConfigEditor.OnInspectorGUI();
     }
 }
コード例 #42
0
		public ObjectPreviewPopup(UnityEngine.Object previewObject)
		{
			if (previewObject == null)
			{
				Debug.LogError("ObjectPreviewPopup: Check object is not null, before trying to show it!");
				return;
			}
			this.m_ObjectName = new GUIContent(previewObject.name, AssetDatabase.GetAssetPath(previewObject));
			this.m_Editor = Editor.CreateEditor(previewObject);
		}
コード例 #43
0
ファイル: LoginSystemEditor.cs プロジェクト: gloowa/mstest
		private void OnGUI(){
			if (database != null) {
				if (editor == null || editor.target != database) {
					editor = Editor.CreateEditor (database);
				}
				scroll=EditorGUILayout.BeginScrollView(scroll);
				editor.OnInspectorGUI ();
				EditorGUILayout.EndScrollView();
			}
		}
コード例 #44
0
ファイル: EditorWrapper.cs プロジェクト: randomize/VimConfig
 public void Dispose()
 {
     if (this.editor != null)
     {
         this.OnSceneDrag = null;
         UnityEngine.Object.DestroyImmediate(this.editor);
         this.editor = null;
     }
     GC.SuppressFinalize(this);
 }
コード例 #45
0
ファイル: Editor.cs プロジェクト: randomize/VimConfig
 public static void CreateCachedEditor(UnityEngine.Object[] targetObjects, System.Type editorType, ref Editor previousEditor)
 {
     if ((previousEditor == null) || !ArrayUtility.ArrayEquals<UnityEngine.Object>(previousEditor.m_Targets, targetObjects))
     {
         if (previousEditor != null)
         {
             UnityEngine.Object.DestroyImmediate(previousEditor);
         }
         previousEditor = CreateEditor(targetObjects, editorType);
     }
 }
コード例 #46
0
ファイル: Editor.cs プロジェクト: randomize/VimConfig
 public static void CreateCachedEditor(UnityEngine.Object targetObject, System.Type editorType, ref Editor previousEditor)
 {
     if (((previousEditor == null) || (previousEditor.m_Targets.Length != 1)) || (previousEditor.m_Targets[0] != targetObject))
     {
         if (previousEditor != null)
         {
             UnityEngine.Object.DestroyImmediate(previousEditor);
         }
         previousEditor = CreateEditor(targetObject, editorType);
     }
 }
コード例 #47
0
 public ObjectPreviewPopup(Object previewObject)
 {
   if (previewObject == (Object) null)
   {
     Debug.LogError((object) "ObjectPreviewPopup: Check object is not null, before trying to show it!");
   }
   else
   {
     this.m_ObjectName = new GUIContent(previewObject.name, AssetDatabase.GetAssetPath(previewObject));
     this.m_Editor = Editor.CreateEditor(previewObject);
   }
 }
コード例 #48
0
 private void OnDisable()
 {
     Object.DestroyImmediate(this.m_TierSettingsEditor);
     this.m_TierSettingsEditor = null;
     Object.DestroyImmediate(this.m_BuiltinShadersEditor);
     this.m_BuiltinShadersEditor = null;
     Object.DestroyImmediate(this.m_AlwaysIncludedShadersEditor);
     this.m_AlwaysIncludedShadersEditor = null;
     Object.DestroyImmediate(this.m_ShaderStrippingEditor);
     this.m_ShaderStrippingEditor = null;
     Object.DestroyImmediate(this.m_ShaderPreloadEditor);
     this.m_ShaderPreloadEditor = null;
 }
コード例 #49
0
ファイル: HOGUISelect.cs プロジェクト: fergu00/hounitylibs
        static bool SetState(Editor editor, EditorWindow editorWindow, IList selectableList, int selectionItemIndex, Color selectionColor)
        {
            if (editor != null) _editor = editor;
            else _editorWindow = editorWindow;
            _selectionColor = selectionColor;
            _selectionColor.a = 0.35f;
            _unfocusedSelectionColor = new Color(selectionColor.r, selectionColor.g, selectionColor.b, 0.15f);
            if (_selectData == null || !_selectData.IsStoredList(selectableList)) _selectData = new GUISelectData(selectableList);
            
            // Check if something was deleted from the list before continuing
            if (selectionItemIndex == -1 || selectionItemIndex > _selectData.selectableItemsDatas.Count - 1) return false;

            GUISelectData.ItemData itemData = _selectData.selectableItemsDatas[selectionItemIndex];
            if (Event.current.type == EventType.Repaint) itemData.rect = GUILayoutUtility.GetLastRect();
            bool wasPressed = itemData.isPressed;
            bool selectionStatusChanged = false;
            if (Event.current.type == EventType.MouseDown) {
                itemData.isPressed = itemData.rect.Contains(Event.current.mousePosition);
                if (wasPressed != itemData.isPressed && !itemData.selected) {
                    selectionStatusChanged = true;
                    if (!itemData.selected) itemData.canBeDeselected = false;
                }
            } else if (Event.current.type == EventType.MouseUp || Event.current.type == EventType.Used || Event.current.type == EventType.DragExited) {
                if (!itemData.canBeDeselected) itemData.canBeDeselected = true;
                else if (itemData.isPressed && itemData.selected && itemData.rect.Contains(Event.current.mousePosition)) selectionStatusChanged = true;
                else if (HOGUIUtils.PanelContainsMouse() && itemData.selected && !Event.current.shift && !Event.current.control && !itemData.rect.Contains(Event.current.mousePosition)) {
                    itemData.selected = false;
                    Repaint();
                }
                itemData.isPressed = false;
            }

            if (selectionStatusChanged) {
                itemData.selected = !itemData.selected;
                if (Event.current.shift) {
                    _selectData.CheckFirstSelectedItem(itemData);
                    SelectRange(_selectData.firstSelectedItemData, itemData);
                } else if (!Event.current.control) {
                    DeselectAll(itemData.selected ? itemData : null);
                    _selectData.CheckFirstSelectedItem(itemData);
                }
                Repaint();
            }

            if (itemData.selected) {
                HOGUI.FlatDivider(itemData.rect, IsFocusedPanel() ? _selectionColor : _unfocusedSelectionColor);
                return true;
            }
            return false;
        }
コード例 #50
0
 public InspectorBase()
 {
     var ext = Path.GetExtension(AssetDatabase.GetAssetPath(Selection.activeObject));
     if (ext == ".pmd" || ext == ".pmx")
     {
         editor = Editor.CreateEditor(Selection.activeObject, typeof(PMDInspector));
     }
     else if (ext == ".vmd")
     {
         editor = Editor.CreateEditor(Selection.activeObject, typeof(VMDInspector));
     }
     else 
     {
         editor = null;
     }
 }
コード例 #51
0
ファイル: EditMode.cs プロジェクト: demelev/projectHL
 private static void ChangeEditMode(SceneViewEditMode mode, Bounds bounds, Editor caller)
 {
     Editor objectFromInstanceID = InternalEditorUtility.GetObjectFromInstanceID(ownerID) as Editor;
     editMode = mode;
     ownerID = (mode == SceneViewEditMode.None) ? 0 : caller.GetInstanceID();
     if (onEditModeEndDelegate != null)
     {
         onEditModeEndDelegate(objectFromInstanceID);
     }
     if ((editMode != SceneViewEditMode.None) && (onEditModeStartDelegate != null))
     {
         onEditModeStartDelegate(caller, editMode);
     }
     EditModeChanged(bounds);
     InspectorWindow.RepaintAllInspectors();
 }
コード例 #52
0
        /// <summary>
        /// Called by Unity when any Texture file is first clicked on and the Inspector is populated.
        /// </summary>
        public void OnEnable()
        {
            // use reflection to get the default Inspector
            Type type = Type.GetType("UnityEditor.TextureImporterInspector, UnityEditor");
            nativeEditor = CreateEditor(target, type);

            // set up the GUI style for the section headers
            guiStyle = new GUIStyle();
            guiStyle.richText = true;
            guiStyle.fontSize = 14;
            guiStyle.normal.textColor = Color.black;

            if (Application.HasProLicense())
            {
                guiStyle.normal.textColor = Color.white;
            }
        }
コード例 #53
0
ファイル: ShaderInspector.cs プロジェクト: lancetipton04/VG
	public override void OnInspectorGUI()
	{
#if UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2
		EditorGUIUtility.LookLikeControls();
#else
		EditorGUIUtility.labelWidth = 0f;
		EditorGUIUtility.fieldWidth = 0f;
#endif
		EditorGUI.indentLevel = 0;
		
		var rc = GUILayoutUtility.GetRect(1f, 13f);
		rc.yMin -= 5f;
		var enabled = GUI.enabled;
		GUI.enabled = true;
		showInfo = InspectorFoldout(rc, showInfo, targets);
		GUI.enabled = enabled;
		if (showInfo)
		{
			if (unityShaderInspectorType == null)
			{
				unityShaderInspectorType = typeof(Editor).Assembly.GetType("UnityEditor.ShaderInspector");
				if (unityShaderInspectorType != null)
				{
					const BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
					internalSetTargetsMethod = unityShaderInspectorType.GetMethod("InternalSetTargets", flags);
				}
			}
			if (targets != null && internalSetTargetsMethod != null)
			{
				if (unityShaderInspector == null)
				{
					unityShaderInspector = Editor.CreateEditor(target, unityShaderInspectorType);
				//	unityShaderInspector = (Editor) CreateInstance(unityShaderInspectorType);
					if (unityShaderInspector)
						internalSetTargetsMethod.Invoke(unityShaderInspector, new object[] { targets.Clone() });
				}
				if (unityShaderInspector)
					unityShaderInspector.OnInspectorGUI();
			}
		}
		
		var assetPath = AssetDatabase.GetAssetPath(target);
		if (!string.IsNullOrEmpty(assetPath) && assetPath.StartsWith("Assets/"))
			base.OnInspectorGUI();
	}
コード例 #54
0
 public override void OnInspectorGUI()
 {
   GUILayout.BeginHorizontal();
   GUILayout.FlexibleSpace();
   EditorGUI.BeginChangeCheck();
   this.m_ActiveEditorIndex = GUILayout.Toolbar(this.m_ActiveEditorIndex, this.m_SubEditorNames);
   if (EditorGUI.EndChangeCheck())
   {
     EditorPrefs.SetInt(this.GetType().Name + "ActiveEditorIndex", this.m_ActiveEditorIndex);
     Editor activeEditor = this.activeEditor;
     this.m_ActiveEditor = (Editor) null;
     UnityEngine.Object.DestroyImmediate((UnityEngine.Object) activeEditor);
     this.m_ActiveEditor = Editor.CreateEditor(this.targets, this.m_SubEditorTypes[this.m_ActiveEditorIndex]);
   }
   GUILayout.FlexibleSpace();
   GUILayout.EndHorizontal();
   this.activeEditor.OnInspectorGUI();
 }
コード例 #55
0
 protected void Init()
 {
   if ((UnityEngine.Object) this.gameObject == (UnityEngine.Object) null)
     return;
   this.m_IsBiped = AvatarBipedMapper.IsBiped(this.gameObject.transform, (List<string>) null);
   if (this.m_Bones == null)
     this.m_Bones = AvatarSetupTool.GetHumanBones(this.serializedObject, this.modelBones);
   this.ValidateMapping();
   if ((UnityEngine.Object) this.m_CurrentTransformEditor != (UnityEngine.Object) null)
   {
     UnityEngine.Object.DestroyImmediate((UnityEngine.Object) this.m_CurrentTransformEditor);
     this.m_CurrentTransformEditor = (Editor) null;
   }
   this.m_CurrentTransformEditorFoldout = true;
   this.m_HasSkinnedMesh = (UnityEngine.Object) this.gameObject.GetComponentInChildren<SkinnedMeshRenderer>() != (UnityEngine.Object) null;
   this.InitPose();
   SceneView.RepaintAll();
 }
コード例 #56
0
        public void OnEnable()
        {
            // Get the UI Skin and Styles for the various Editors
            TMP_UIStyleManager.GetUIStyles();

            fontAsset_prop = serializedObject.FindProperty("m_fontAsset");
            spriteAsset_prop = serializedObject.FindProperty("m_spriteAsset");

            m_SubMeshComponent = target as TMP_SubMeshUI;
            //m_rectTransform = m_SubMeshComponent.rectTransform;
            m_canvasRenderer = m_SubMeshComponent.canvasRenderer;

            // Create new Material Editor if one does not exists
            if (m_canvasRenderer != null && m_canvasRenderer.GetMaterial() != null)
            {
                m_materialEditor = Editor.CreateEditor(m_canvasRenderer.GetMaterial());
                m_targetMaterial = m_canvasRenderer.GetMaterial();
            }
        }
コード例 #57
0
        //Drag-n-Drop related properties
        //private Rect m_inspectorStartRegion;
        //private Rect m_inspectorEndRegion;
        public void OnEnable()
        {
            // Get the UI Skin and Styles for the various Editors
            TMP_UIStyleManager.GetUIStyles();

            //fontSharedMaterial_prop = serializedObject.FindProperty("m_sharedMaterial");
            //raycastTarget_prop = serializedObject.FindProperty("m_RaycastTarget");

            m_SubMeshComponent = target as TMP_SubMeshUI;
            //m_rectTransform = m_SubMeshComponent.rectTransform;
            m_canvasRenderer = m_SubMeshComponent.canvasRenderer;

            // Create new Material Editor if one does not exists
            if (m_canvasRenderer != null && m_canvasRenderer.GetMaterial() != null)
            {
                m_materialEditor = Editor.CreateEditor(m_canvasRenderer.GetMaterial());
                m_targetMaterial = m_canvasRenderer.GetMaterial();

                //UnityEditorInternal.InternalEditorUtility.SetIsInspectorExpanded(m_targetMaterial, true);
                //Debug.Log("Currently Assigned Material is " + m_targetMaterial + ".  Font Material is " + m_textMeshProScript.fontSharedMaterial);
            }
        }
コード例 #58
0
		public override void OnInspectorGUI()
		{
			EditorGUI.BeginDisabledGroup(false);
			GUI.enabled = true;
			GUILayout.BeginHorizontal(new GUILayoutOption[0]);
			GUILayout.FlexibleSpace();
			EditorGUI.BeginChangeCheck();
			this.m_ActiveEditorIndex = GUILayout.Toolbar(this.m_ActiveEditorIndex, this.m_SubEditorNames, new GUILayoutOption[0]);
			if (EditorGUI.EndChangeCheck())
			{
				EditorPrefs.SetInt(base.GetType().Name + "ActiveEditorIndex", this.m_ActiveEditorIndex);
				AssetImporterInspector activeEditor = this.activeEditor;
				this.m_ActiveEditor = null;
				UnityEngine.Object.DestroyImmediate(activeEditor);
				this.m_ActiveEditor = (Editor.CreateEditor(base.targets, this.m_SubEditorTypes[this.m_ActiveEditorIndex]) as AssetImporterInspector);
				this.m_ActiveEditor.assetEditor = this.assetEditor;
			}
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
			EditorGUI.EndDisabledGroup();
			this.activeEditor.OnInspectorGUI();
		}
コード例 #59
0
        public override void OnInspectorGUI()
        {
            // Make sure Multi selection only includes TMP Text objects.
            if (IsMixSelectionTypes()) return;

            serializedObject.Update();

            //EditorGUIUtility.LookLikeControls(150, 30);
            Rect rect;
            float labelWidth = EditorGUIUtility.labelWidth = 130f;
            float fieldWidth = EditorGUIUtility.fieldWidth;

            // TEXT INPUT BOX SECTION
            if (GUILayout.Button("<b>TEXT INPUT BOX</b>" + (m_foldout.textInput ? uiStateLabel[1] : uiStateLabel[0]), TMP_UIStyleManager.Section_Label))
                m_foldout.textInput = !m_foldout.textInput;

            if (m_foldout.textInput)
            {
                EditorGUI.BeginChangeCheck();
                text_prop.stringValue = EditorGUILayout.TextArea(text_prop.stringValue, TMP_UIStyleManager.TextAreaBoxEditor, GUILayout.Height(125), GUILayout.ExpandWidth(true));
                if (EditorGUI.EndChangeCheck())
                {
                    inputSource_prop.enumValueIndex = 0;
                    isInputPasingRequired_prop.boolValue = true;
                    //isCalculateSizeRequired_prop.boolValue = true;
                    havePropertiesChanged = true;
                }
            }

            // FONT SETTINGS SECTION
            if (GUILayout.Button("<b>FONT SETTINGS</b>" + (m_foldout.fontSettings ? uiStateLabel[1] : uiStateLabel[0]), TMP_UIStyleManager.Section_Label))
                m_foldout.fontSettings = !m_foldout.fontSettings;

            if (m_foldout.fontSettings)
            {
                // FONT ASSET
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(fontAsset_prop);
                if (EditorGUI.EndChangeCheck())
                {
                    //Undo.RecordObject(m_textMeshProScript, "Material Change");
                    havePropertiesChanged = true;
                    hasFontAssetChanged_prop.boolValue = true;
                }

                // FONT STYLE
                EditorGUI.BeginChangeCheck();

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.PrefixLabel("Font Style");
                int styleValue = fontStyle_prop.intValue;

                int v1 = GUILayout.Toggle((styleValue & 1) == 1, "B", GUI.skin.button) ? 1 : 0; // Bold
                int v2 = GUILayout.Toggle((styleValue & 2) == 2, "I", GUI.skin.button) ? 2 : 0; // Italics
                int v3 = GUILayout.Toggle((styleValue & 4) == 4, "U", GUI.skin.button) ? 4 : 0; // Underline
                int v7 = GUILayout.Toggle((styleValue & 64) == 64, "S", GUI.skin.button) ? 64 : 0; // Strikethrough
                int v4 = GUILayout.Toggle((styleValue & 8) == 8, "ab", GUI.skin.button) ? 8 : 0; // Lowercase
                int v5 = GUILayout.Toggle((styleValue & 16) == 16, "AB", GUI.skin.button) ? 16 : 0; // Uppercase
                int v6 = GUILayout.Toggle((styleValue & 32) == 32, "SC", GUI.skin.button) ? 32 : 0; // Smallcaps
                EditorGUILayout.EndHorizontal();

                if (EditorGUI.EndChangeCheck())
                {
                    fontStyle_prop.intValue = v1 + v2 + v3 + v4 + v5 + v6 + v7;
                    havePropertiesChanged = true;
                }

                // FACE VERTEX COLOR
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(fontColor_prop, new GUIContent("Color (Vertex)"));

                // VERTEX COLOR GRADIENT
                EditorGUILayout.BeginHorizontal();
                //EditorGUILayout.PrefixLabel("Color Gradient");
                EditorGUILayout.PropertyField(enableVertexGradient_prop, new GUIContent("Color Gradient"), GUILayout.MinWidth(140), GUILayout.MaxWidth(200));
                EditorGUIUtility.labelWidth = 95;
                EditorGUILayout.PropertyField(overrideHtmlColor_prop, new GUIContent("Override Tags"));
                EditorGUIUtility.labelWidth = labelWidth;
                EditorGUILayout.EndHorizontal();

                if (enableVertexGradient_prop.boolValue)
                {
                    EditorGUILayout.PropertyField(fontColorGradient_prop.FindPropertyRelative("topLeft"), new GUIContent("Top Left"));
                    EditorGUILayout.PropertyField(fontColorGradient_prop.FindPropertyRelative("topRight"), new GUIContent("Top Right"));
                    EditorGUILayout.PropertyField(fontColorGradient_prop.FindPropertyRelative("bottomLeft"), new GUIContent("Bottom Left"));
                    EditorGUILayout.PropertyField(fontColorGradient_prop.FindPropertyRelative("bottomRight"), new GUIContent("Bottom Right"));
                }
                if (EditorGUI.EndChangeCheck())
                {
                    havePropertiesChanged = true;
                }

                // FONT SIZE
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.PropertyField(fontSize_prop, new GUIContent("Font Size"), GUILayout.MinWidth(168), GUILayout.MaxWidth(200));
                EditorGUIUtility.fieldWidth = fieldWidth;
                if (EditorGUI.EndChangeCheck())
                {
                    fontSizeBase_prop.floatValue = fontSize_prop.floatValue;
                    havePropertiesChanged = true;
                    //isAffectingWordWrapping_prop.boolValue = true;
                }

                EditorGUI.BeginChangeCheck();
                EditorGUIUtility.labelWidth = 70;
                EditorGUILayout.PropertyField(autoSizing_prop, new GUIContent("Auto Size"));
                EditorGUILayout.EndHorizontal();

                EditorGUIUtility.labelWidth = labelWidth;
                if (EditorGUI.EndChangeCheck())
                {
                    if (autoSizing_prop.boolValue == false)
                        fontSize_prop.floatValue = fontSizeBase_prop.floatValue;

                    havePropertiesChanged = true;
                    //isAffectingWordWrapping_prop.boolValue = true;
                }

                // Show auto sizing options
                if (autoSizing_prop.boolValue)
                {
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.PrefixLabel("Auto Size Options");
                    EditorGUIUtility.labelWidth = 24;

                    EditorGUI.BeginChangeCheck();
                    EditorGUILayout.PropertyField(fontSizeMin_prop, new GUIContent("Min"), GUILayout.MinWidth(46));
                    if (EditorGUI.EndChangeCheck())
                    {
                        fontSizeMin_prop.floatValue = Mathf.Min(fontSizeMin_prop.floatValue, fontSizeMax_prop.floatValue);
                        havePropertiesChanged = true;
                    }

                    EditorGUIUtility.labelWidth = 27;
                    EditorGUI.BeginChangeCheck();
                    EditorGUILayout.PropertyField(fontSizeMax_prop, new GUIContent("Max"), GUILayout.MinWidth(49));
                    if (EditorGUI.EndChangeCheck())
                    {
                        fontSizeMax_prop.floatValue = Mathf.Max(fontSizeMin_prop.floatValue, fontSizeMax_prop.floatValue);
                        havePropertiesChanged = true;
                    }

                    EditorGUI.BeginChangeCheck();
                    EditorGUIUtility.labelWidth = 36;
                    //EditorGUILayout.PropertyField(charSpacingMax_prop, new GUIContent("Char"), GUILayout.MinWidth(50));
                    EditorGUILayout.PropertyField(charWidthMaxAdj_prop, new GUIContent("WD%"), GUILayout.MinWidth(58));
                    EditorGUIUtility.labelWidth = 28;
                    EditorGUILayout.PropertyField(lineSpacingMax_prop, new GUIContent("Line"), GUILayout.MinWidth(50));

                    EditorGUIUtility.labelWidth = labelWidth;
                    EditorGUILayout.EndHorizontal();

                    if (EditorGUI.EndChangeCheck())
                    {
                        charWidthMaxAdj_prop.floatValue = Mathf.Clamp(charWidthMaxAdj_prop.floatValue, 0, 50);
                        //charSpacingMax_prop.floatValue = Mathf.Min(0, charSpacingMax_prop.floatValue);
                        lineSpacingMax_prop.floatValue = Mathf.Min(0, lineSpacingMax_prop.floatValue);
                        havePropertiesChanged = true;
                    }
                }

                // CHARACTER, LINE & PARAGRAPH SPACING
                EditorGUI.BeginChangeCheck();

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.PrefixLabel("Spacing Options");
                EditorGUIUtility.labelWidth = 30;
                EditorGUILayout.PropertyField(characterSpacing_prop, new GUIContent("Char"), GUILayout.MinWidth(50)); //, GUILayout.MaxWidth(100));
                EditorGUILayout.PropertyField(lineSpacing_prop, new GUIContent("Line"), GUILayout.MinWidth(50)); //, GUILayout.MaxWidth(100));
                EditorGUILayout.PropertyField(paragraphSpacing_prop, new GUIContent(" Par."), GUILayout.MinWidth(50)); //, GUILayout.MaxWidth(100));

                EditorGUIUtility.labelWidth = labelWidth;
                EditorGUILayout.EndHorizontal();

                if (EditorGUI.EndChangeCheck())
                {
                    havePropertiesChanged = true;
                    //isAffectingWordWrapping_prop.boolValue = true;
                }

                // TEXT ALIGNMENT
                EditorGUI.BeginChangeCheck();

                rect = EditorGUILayout.GetControlRect(false, 17);
                GUIStyle btn = new GUIStyle(GUI.skin.button);
                btn.margin = new RectOffset(1, 1, 1, 1);
                btn.padding = new RectOffset(1, 1, 1, 0);

                selAlignGrid_A = textAlignment_prop.enumValueIndex & ~28;
                selAlignGrid_B = (textAlignment_prop.enumValueIndex & ~3) / 4;

                GUI.Label(new Rect(rect.x, rect.y, 100, rect.height), "Alignment");
                float columnB = EditorGUIUtility.labelWidth + 15;
                selAlignGrid_A = GUI.SelectionGrid(new Rect(columnB, rect.y, 23 * 4, rect.height), selAlignGrid_A, TMP_UIStyleManager.alignContent_A, 4, btn);
                selAlignGrid_B = GUI.SelectionGrid(new Rect(columnB + 23 * 4 + 10, rect.y, 23 * 5, rect.height), selAlignGrid_B, TMP_UIStyleManager.alignContent_B, 5, btn);

                if (EditorGUI.EndChangeCheck())
                {
                    textAlignment_prop.enumValueIndex = selAlignGrid_A + selAlignGrid_B * 4;
                    havePropertiesChanged = true;
                }

                // WRAPPING RATIOS shown if Justified mode is selected.
                EditorGUI.BeginChangeCheck();
                if (textAlignment_prop.enumValueIndex == 3 || textAlignment_prop.enumValueIndex == 7 || textAlignment_prop.enumValueIndex == 11 || textAlignment_prop.enumValueIndex == 19)
                    DrawPropertySlider("Wrap Mix (W <-> C)", wordWrappingRatios_prop);

                if (EditorGUI.EndChangeCheck())
                    havePropertiesChanged = true;

                // TEXT WRAPPING & OVERFLOW
                EditorGUI.BeginChangeCheck();

                rect = EditorGUILayout.GetControlRect(false);
                EditorGUI.PrefixLabel(new Rect(rect.x, rect.y, 130, rect.height), new GUIContent("Wrapping & Overflow"));
                rect.width = (rect.width - 130) / 2f;
                rect.x += 130;
                int wrapSelection = EditorGUI.Popup(rect, enableWordWrapping_prop.boolValue ? 1 : 0, new string[] { "Disabled", "Enabled" });
                if (EditorGUI.EndChangeCheck())
                {
                    enableWordWrapping_prop.boolValue = wrapSelection == 1 ? true : false;
                    havePropertiesChanged = true;
                    isInputPasingRequired_prop.boolValue = true;
                }

                // TEXT OVERFLOW
                EditorGUI.BeginChangeCheck();
                if (textOverflowMode_prop.enumValueIndex != 5)
                {
                    rect.x += rect.width + 5f;
                    rect.width -= 5;
                    EditorGUI.PropertyField(rect, textOverflowMode_prop, GUIContent.none);
                }
                else
                {
                    rect.x += rect.width + 5f;
                    rect.width /= 2;
                    EditorGUI.PropertyField(rect, textOverflowMode_prop, GUIContent.none);
                    rect.x += rect.width;
                    rect.width -= 5;
                    EditorGUI.PropertyField(rect, pageToDisplay_prop, GUIContent.none);
                }
                if (EditorGUI.EndChangeCheck())
                {
                    havePropertiesChanged = true;
                    isInputPasingRequired_prop.boolValue = true;
                }

                // TEXTURE MAPPING OPTIONS
                EditorGUI.BeginChangeCheck();
                rect = EditorGUILayout.GetControlRect(false);
                EditorGUI.PrefixLabel(new Rect(rect.x, rect.y, 130, rect.height), new GUIContent("UV Mapping Options"));
                rect.width = (rect.width - 130) / 2f;
                rect.x += 130;
                EditorGUI.PropertyField(rect, horizontalMapping_prop, GUIContent.none);
                rect.x += rect.width + 5f;
                rect.width -= 5;
                EditorGUI.PropertyField(rect, verticalMapping_prop, GUIContent.none);
                if (EditorGUI.EndChangeCheck())
                {
                    havePropertiesChanged = true;
                }

                // UV OPTIONS
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.PrefixLabel("UV Offset");
                EditorGUILayout.PropertyField(uvOffset_prop, GUIContent.none, GUILayout.MinWidth(70f));
                EditorGUIUtility.labelWidth = 30;
                EditorGUILayout.PropertyField(uvLineOffset_prop, new GUIContent("Line"), GUILayout.MinWidth(70f));
                EditorGUIUtility.labelWidth = labelWidth;
                EditorGUILayout.EndHorizontal();
                if (EditorGUI.EndChangeCheck())
                {
                    havePropertiesChanged = true;
                }

                // KERNING
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.PropertyField(enableKerning_prop, new GUIContent("Enable Kerning?"));
                if (EditorGUI.EndChangeCheck())
                {
                    //isAffectingWordWrapping_prop.boolValue = true;
                    havePropertiesChanged = true;
                }

                // EXTRA PADDING
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(enableExtraPadding_prop, new GUIContent("Extra Padding?"));
                if (EditorGUI.EndChangeCheck())
                {
                    havePropertiesChanged = true;
                    checkPaddingRequired_prop.boolValue = true;
                }
                EditorGUILayout.EndHorizontal();
            }

            if (GUILayout.Button("<b>EXTRA SETTINGS</b>" + (m_foldout.extraSettings ? uiStateLabel[1] : uiStateLabel[0]), TMP_UIStyleManager.Section_Label))
                m_foldout.extraSettings = !m_foldout.extraSettings;

            if (m_foldout.extraSettings)
            {
                EditorGUI.indentLevel = 0;

                EditorGUI.BeginChangeCheck();
                DrawMaginProperty(margin_prop, "Margins");
                //DrawMaginProperty(maskOffset_prop, "Mask Offset");

                //EditorGUILayout.BeginHorizontal();
                //EditorGUILayout.PropertyField(sortingLayerID_prop);
                //EditorGUILayout.PropertyField(sortingOrder_prop);

                //EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.PropertyField(isRichText_prop, new GUIContent("Enable Rich Text?"));
                EditorGUILayout.PropertyField(raycastTarget_prop, new GUIContent("Raycast Target?"));
                EditorGUILayout.EndHorizontal();

                //EditorGUILayout.PropertyField(textRectangle_prop, true);

                if (EditorGUI.EndChangeCheck())
                    havePropertiesChanged = true;

                // EditorGUI.BeginChangeCheck();
                //EditorGUILayout.PropertyField(mask_prop);
                //EditorGUILayout.PropertyField(maskOffset_prop, true);
                //EditorGUILayout.PropertyField(maskSoftness_prop);
                //if (EditorGUI.EndChangeCheck())
                //{
                //    isMaskUpdateRequired_prop.boolValue = true;
                //    havePropertiesChanged = true;
                //}

                //EditorGUILayout.PropertyField(sortingLayerID_prop);
                //EditorGUILayout.PropertyField(sortingOrder_prop);

                // Mask Selection
            }

            EditorGUILayout.Space();

            // If a Custom Material Editor exists, we use it.
            if (m_uiRenderer != null && m_uiRenderer.GetMaterial() != null)
            {
                Material mat = m_uiRenderer.GetMaterial();

                //Debug.Log(mat + "  " + m_targetMaterial);

                if (mat != m_targetMaterial)
                {
                    // Destroy previous Material Instance
                    //Debug.Log("New Material has been assigned.");
                    m_targetMaterial = mat;
                    DestroyImmediate(m_materialEditor);
                }

                if (m_materialEditor == null)
                {
                    m_materialEditor = Editor.CreateEditor(mat);
                }

                m_materialEditor.DrawHeader();

                m_materialEditor.OnInspectorGUI();
            }

            if (havePropertiesChanged)
            {
                //Debug.Log("Properties have changed.");
                havePropertiesChanged_prop.boolValue = true;
                havePropertiesChanged = false;
                EditorUtility.SetDirty(target);
            }

            serializedObject.ApplyModifiedProperties();

            //m_targetMaterial = m_uiRenderer.GetMaterial();
        }
コード例 #60
0
        //private float prev_lineLenght;
        //private bool m_isUndoSet;
        public void OnEnable()
        {
            //Debug.Log("New Instance of TMPRO UGUI Editor with ID " + this.GetInstanceID());

            // Initialize the Event Listener for Undo Events.
            Undo.undoRedoPerformed += OnUndoRedo;
            //Undo.postprocessModifications += OnUndoRedoEvent;

            text_prop = serializedObject.FindProperty("m_text");
            fontAsset_prop = serializedObject.FindProperty("m_fontAsset");
            fontSharedMaterial_prop = serializedObject.FindProperty("m_sharedMaterial");
            //fontBaseMaterial_prop = serializedObject.FindProperty("m_baseMaterial");
            isNewBaseMaterial_prop = serializedObject.FindProperty("m_isNewBaseMaterial");

            fontStyle_prop = serializedObject.FindProperty("m_fontStyle");

            fontSize_prop = serializedObject.FindProperty("m_fontSize");
            fontSizeBase_prop = serializedObject.FindProperty("m_fontSizeBase");

            autoSizing_prop = serializedObject.FindProperty("m_enableAutoSizing");
            fontSizeMin_prop = serializedObject.FindProperty("m_fontSizeMin");
            fontSizeMax_prop = serializedObject.FindProperty("m_fontSizeMax");
            //charSpacingMax_prop = serializedObject.FindProperty("m_charSpacingMax");
            lineSpacingMax_prop = serializedObject.FindProperty("m_lineSpacingMax");
            charWidthMaxAdj_prop = serializedObject.FindProperty("m_charWidthMaxAdj");

            // Colors & Gradient
            fontColor_prop = serializedObject.FindProperty("m_fontColor");
            enableVertexGradient_prop = serializedObject.FindProperty ("m_enableVertexGradient");
            fontColorGradient_prop = serializedObject.FindProperty ("m_fontColorGradient");
            overrideHtmlColor_prop = serializedObject.FindProperty("m_overrideHtmlColors");

            characterSpacing_prop = serializedObject.FindProperty("m_characterSpacing");
            lineSpacing_prop = serializedObject.FindProperty("m_lineSpacing");
            paragraphSpacing_prop = serializedObject.FindProperty("m_paragraphSpacing");

            textAlignment_prop = serializedObject.FindProperty("m_textAlignment");

            enableWordWrapping_prop = serializedObject.FindProperty("m_enableWordWrapping");
            wordWrappingRatios_prop = serializedObject.FindProperty("m_wordWrappingRatios");
            textOverflowMode_prop = serializedObject.FindProperty("m_overflowMode");
            pageToDisplay_prop = serializedObject.FindProperty("m_pageToDisplay");

            horizontalMapping_prop = serializedObject.FindProperty("m_horizontalMapping");
            verticalMapping_prop = serializedObject.FindProperty("m_verticalMapping");
            uvOffset_prop = serializedObject.FindProperty("m_uvOffset");
            uvLineOffset_prop = serializedObject.FindProperty("m_uvLineOffset");

            enableKerning_prop = serializedObject.FindProperty("m_enableKerning");

            //isOrthographic_prop = serializedObject.FindProperty("m_isOrthographic");

            havePropertiesChanged_prop = serializedObject.FindProperty("m_havePropertiesChanged");
            inputSource_prop = serializedObject.FindProperty("m_inputSource");
            isInputPasingRequired_prop = serializedObject.FindProperty("isInputParsingRequired");
            //isCalculateSizeRequired_prop = serializedObject.FindProperty("m_isCalculateSizeRequired");
            enableExtraPadding_prop = serializedObject.FindProperty("m_enableExtraPadding");
            isRichText_prop = serializedObject.FindProperty("m_isRichText");
            checkPaddingRequired_prop = serializedObject.FindProperty("checkPaddingRequired");
            raycastTarget_prop = serializedObject.FindProperty("m_RaycastTarget");

            margin_prop = serializedObject.FindProperty("m_margin");

            //isMaskUpdateRequired_prop = serializedObject.FindProperty("isMaskUpdateRequired");
            //mask_prop = serializedObject.FindProperty("m_mask");
            //maskOffset_prop= serializedObject.FindProperty("m_maskOffset");
            //maskOffsetMode_prop = serializedObject.FindProperty("m_maskOffsetMode");
            //maskSoftness_prop = serializedObject.FindProperty("m_maskSoftness");
            //vertexOffset_prop = serializedObject.FindProperty("m_vertexOffset");

            //sortingLayerID_prop = serializedObject.FindProperty("m_sortingLayerID");
            //sortingOrder_prop = serializedObject.FindProperty("m_sortingOrder");

            hasFontAssetChanged_prop = serializedObject.FindProperty("hasFontAssetChanged");

            // Get the UI Skin and Styles for the various Editors
            TMP_UIStyleManager.GetUIStyles();

            m_textMeshProScript = (TextMeshProUGUI)target;
            m_rectTransform = Selection.activeGameObject.GetComponent<RectTransform>();
            m_uiRenderer = Selection.activeGameObject.GetComponent<CanvasRenderer>();

            // Add a Material Component if one does not exists
            /*
            m_materialComponent = Selection.activeGameObject.GetComponent<MaterialComponent> ();
            if (m_materialComponent == null)
            {
                m_materialComponent = Selection.activeGameObject.AddComponent<MaterialComponent> ();
            }
            */

            // Create new Material Editor if one does not exists
            if (m_uiRenderer != null && m_uiRenderer.GetMaterial() != null)
            {
                m_materialEditor = Editor.CreateEditor(m_uiRenderer.GetMaterial());
                m_targetMaterial = m_uiRenderer.GetMaterial();

                //UnityEditorInternal.InternalEditorUtility.SetIsInspectorExpanded(m_targetMaterial, true);
                //Debug.Log("Currently Assigned Material is " + m_targetMaterial + ".  Font Material is " + m_textMeshProScript.fontSharedMaterial);
            }

            //m_updateManager = Camera.main.gameObject.GetComponent<TMPro_UpdateManager>();
        }