• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# UnityEditor.Editor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中UnityEditor.Editor的典型用法代码示例。如果您正苦于以下问题:C# Editor类的具体用法?C# Editor怎么用?C# Editor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Editor类属于UnityEditor命名空间,在下文中一共展示了Editor类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Init

		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;
		}
开发者ID:guozanhua,项目名称:UnityDecompiled,代码行数:27,代码来源:EditorWrapper.cs


示例2: OnEditModeStart

		protected void OnEditModeStart(Editor editor, EditMode.SceneViewEditMode mode)
		{
			if (mode == EditMode.SceneViewEditMode.Collider && editor == this)
			{
				this.OnEditStart();
			}
		}
开发者ID:guozanhua,项目名称:UnityDecompiled,代码行数:7,代码来源:ColliderEditorBase.cs


示例3: DoEditModeInspectorModeButton

 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);
         }
     }
 }
开发者ID:demelev,项目名称:projectHL,代码行数:27,代码来源:EditMode.cs


示例4: OnEditModeEnd

		protected void OnEditModeEnd(Editor editor)
		{
			if (editor == this)
			{
				this.OnEditEnd();
			}
		}
开发者ID:guozanhua,项目名称:UnityDecompiled,代码行数:7,代码来源:ColliderEditorBase.cs


示例5: OnEnable

 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]);
 }
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:7,代码来源:TabbedEditor.cs


示例6: OnEditModeStart

 protected void OnEditModeStart(Editor editor, UnityEditorInternal.EditMode.SceneViewEditMode mode)
 {
     if ((mode == UnityEditorInternal.EditMode.SceneViewEditMode.Collider) && (editor == this))
     {
         this.OnEditStart();
     }
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:7,代码来源:ColliderEditorBase.cs


示例7: OnGUI

 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();
 }
开发者ID:OrangeShotman,项目名称:MobDestroy,代码行数:27,代码来源:LootManager.cs


示例8: OnEnable

 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]);
     }
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:8,代码来源:TabbedEditor.cs


示例9: StartDrag

 /// <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);
 }
开发者ID:fergu00,项目名称:hounitylibs,代码行数:16,代码来源:HOGUIDrag.cs


示例10: DrawInspector

		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();

		}
开发者ID:Cyberbanan,项目名称:Unity3d.UI.Windows,代码行数:57,代码来源:EditorUtilitiesEx.cs


示例11: OnGUI

 void OnGUI()
 {
     if (serverConfig != null) {
        if (serverConfigEditor == null) {
             serverConfigEditor = Editor.CreateEditor(serverConfig);
         }
         serverConfigEditor.OnInspectorGUI();
     }
 }
开发者ID:gamemachine,项目名称:gamemachine,代码行数:9,代码来源:GameMachineEditor.cs


示例12: ObjectPreviewPopup

		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);
		}
开发者ID:guozanhua,项目名称:UnityDecompiled,代码行数:10,代码来源:ObjectPreviewPopup.cs


示例13: OnGUI

		private void OnGUI(){
			if (database != null) {
				if (editor == null || editor.target != database) {
					editor = Editor.CreateEditor (database);
				}
				scroll=EditorGUILayout.BeginScrollView(scroll);
				editor.OnInspectorGUI ();
				EditorGUILayout.EndScrollView();
			}
		}
开发者ID:gloowa,项目名称:mstest,代码行数:10,代码来源:LoginSystemEditor.cs


示例14: CreateCachedEditor

 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);
     }
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:11,代码来源:Editor.cs


示例15: ObjectPreviewPopup

 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);
   }
 }
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:12,代码来源:ObjectPreviewPopup.cs


示例16: OnDisable

 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;
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:13,代码来源:GraphicsSettingsWindow.cs


示例17: SetState

        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;
        }
开发者ID:fergu00,项目名称:hounitylibs,代码行数:50,代码来源:HOGUISelect.cs


示例18: InspectorBase

 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;
     }
 }
开发者ID:hecomi,项目名称:StereoAR-for-Unity,代码行数:16,代码来源:InspectorBase.cs


示例19: ChangeEditMode

 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();
 }
开发者ID:demelev,项目名称:projectHL,代码行数:16,代码来源:EditMode.cs


示例20: OnEnable

        /// <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;
            }
        }
开发者ID:gekidoslair,项目名称:UnityPSDLayoutTool,代码行数:20,代码来源:PsdInspector.cs



注:本文中的UnityEditor.Editor类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# UnityEditor.EditorCurveBinding类代码示例发布时间:2022-05-26
下一篇:
C# SchedulerTests.UnitTestSchedulingContext类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap