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

C# UnityEditor类代码示例

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

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



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

示例1: GetFiltered

 public static UnityEngine.Object[] GetFiltered(System.Type type, UnityEditor.SelectionMode mode)
 {
     ArrayList list = new ArrayList();
     if ((type == typeof(Component)) || type.IsSubclassOf(typeof(Component)))
     {
         foreach (Transform transform in GetTransforms(mode))
         {
             Component component = transform.GetComponent(type);
             if (component != null)
             {
                 list.Add(component);
             }
         }
     }
     else if ((type == typeof(GameObject)) || type.IsSubclassOf(typeof(GameObject)))
     {
         foreach (Transform transform2 in GetTransforms(mode))
         {
             list.Add(transform2.gameObject);
         }
     }
     else
     {
         foreach (UnityEngine.Object obj2 in GetObjectsMode(mode))
         {
             if ((obj2 != null) && ((obj2.GetType() == type) || obj2.GetType().IsSubclassOf(type)))
             {
                 list.Add(obj2);
             }
         }
     }
     return (UnityEngine.Object[]) list.ToArray(typeof(UnityEngine.Object));
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:33,代码来源:Selection.cs


示例2: Connect

 public override void Connect(UnityEditor.Graphs.AnimationStateMachine.Node toNode, UnityEditor.Graphs.Edge edge)
 {
     if (toNode is StateNode)
     {
         base.graphGUI.stateMachineGraph.activeStateMachine.AddStateMachineTransition(this.stateMachine, (toNode as StateNode).state);
         base.graphGUI.stateMachineGraph.RebuildGraph();
     }
     else if (toNode is StateMachineNode)
     {
         UnityEditor.Graphs.AnimationStateMachine.Node.GenericMenuForStateMachineNode(toNode as StateMachineNode, true, delegate (object data) {
             if (data is AnimatorState)
             {
                 base.graphGUI.stateMachineGraph.activeStateMachine.AddStateMachineTransition(this.stateMachine, data as AnimatorState);
             }
             else
             {
                 base.graphGUI.stateMachineGraph.activeStateMachine.AddStateMachineTransition(this.stateMachine, data as AnimatorStateMachine);
             }
             base.graphGUI.stateMachineGraph.RebuildGraph();
         });
     }
     else if (toNode is ExitNode)
     {
         base.graphGUI.stateMachineGraph.activeStateMachine.AddStateMachineExitTransition(this.stateMachine);
         base.graphGUI.stateMachineGraph.RebuildGraph();
     }
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:27,代码来源:StateMachineNode.cs


示例3: NodeUI

 public override void NodeUI(UnityEditor.Graphs.GraphGUI host)
 {
     base.graphGUI = host as UnityEditor.Graphs.AnimationStateMachine.GraphGUI;
     Assert.NotNull(base.graphGUI);
     if (UnityEditor.Graphs.AnimationStateMachine.Node.IsLeftClick())
     {
         host.edgeGUI.EndSlotDragging(Enumerable.First<Slot>(base.inputSlots), true);
     }
     if (UnityEditor.Graphs.AnimationStateMachine.Node.IsDoubleClick())
     {
         if (this.stateMachine == base.graphGUI.stateMachineGraph.parentStateMachine)
         {
             base.graphGUI.tool.GoToBreadCrumbTarget(this.stateMachine);
         }
         else
         {
             base.graphGUI.tool.AddBreadCrumb(this.stateMachine);
         }
         Event.current.Use();
     }
     if (UnityEditor.Graphs.AnimationStateMachine.Node.IsRightClick() && (this.stateMachine != base.graphGUI.stateMachineGraph.parentStateMachine))
     {
         GenericMenu menu = new GenericMenu();
         menu.AddItem(new GUIContent("Make Transition"), false, new GenericMenu.MenuFunction(this.MakeTransitionCallback));
         menu.AddItem(new GUIContent("Copy"), false, new GenericMenu.MenuFunction(this.CopyStateMachineCallback));
         menu.AddItem(new GUIContent("Delete"), false, new GenericMenu.MenuFunction(this.DeleteStateMachineCallback));
         menu.ShowAsContext();
         Event.current.Use();
     }
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:30,代码来源:StateMachineNode.cs


示例4: GenerateObjectTypeGroups

 private static List<MemoryElement> GenerateObjectTypeGroups(UnityEditor.ObjectInfo[] memory, ObjectTypeFilter filter)
 {
     List<MemoryElement> list = new List<MemoryElement>();
     MemoryElement item = null;
     foreach (UnityEditor.ObjectInfo info in memory)
     {
         if (GetObjectTypeFilter(info) == filter)
         {
             if ((item == null) || (info.className != item.name))
             {
                 item = new MemoryElement(info.className);
                 list.Add(item);
             }
             item.AddChild(new MemoryElement(info, true));
         }
     }
     list.Sort(new Comparison<MemoryElement>(MemoryElementDataManager.SortByMemorySize));
     foreach (MemoryElement element2 in list)
     {
         element2.children.Sort(new Comparison<MemoryElement>(MemoryElementDataManager.SortByMemorySize));
         if ((filter == ObjectTypeFilter.Other) && !HasValidNames(element2.children))
         {
             element2.children.Clear();
         }
     }
     return list;
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:27,代码来源:MemoryElementDataManager.cs


示例5: SceneEntry

			/// <summary>
			/// Construct from a Unity SceneSetup
			/// </summary>
			public SceneEntry( UnityEditor.SceneManagement.SceneSetup sceneSetup )
			{
				scene = new AmsSceneReference( sceneSetup.path );

				loadInEditor = sceneSetup.isLoaded;
				loadMethod = LoadMethod.Additive;
			}
开发者ID:santiamchristian,项目名称:compro2016,代码行数:10,代码来源:AmsMultiSceneSetup.cs


示例6: Connect

 public override void Connect(UnityEditor.Graphs.AnimationStateMachine.Node toNode, UnityEditor.Graphs.Edge edge)
 {
     if (toNode is StateNode)
     {
         base.graphGUI.stateMachineGraph.rootStateMachine.AddAnyStateTransition((toNode as StateNode).state);
         base.graphGUI.stateMachineGraph.RebuildGraph();
     }
     if (toNode is StateMachineNode)
     {
         StateMachineNode node = toNode as StateMachineNode;
         if (node.stateMachine != base.graphGUI.parentStateMachine)
         {
             UnityEditor.Graphs.AnimationStateMachine.Node.GenericMenuForStateMachineNode(toNode as StateMachineNode, true, delegate (object data) {
                 if (data is AnimatorState)
                 {
                     base.graphGUI.stateMachineGraph.rootStateMachine.AddAnyStateTransition(data as AnimatorState);
                 }
                 else if (data is AnimatorStateMachine)
                 {
                     base.graphGUI.stateMachineGraph.rootStateMachine.AddAnyStateTransition(data as AnimatorStateMachine);
                 }
                 base.graphGUI.stateMachineGraph.RebuildGraph();
             });
         }
     }
     if (toNode is EntryNode)
     {
         base.graphGUI.stateMachineGraph.rootStateMachine.AddAnyStateTransition(base.graphGUI.activeStateMachine);
     }
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:30,代码来源:AnyStateNode.cs


示例7: NodeUI

 public override void NodeUI(UnityEditor.Graphs.GraphGUI host)
 {
     if (UnityEditor.Graphs.AnimationStateMachine.Node.IsLeftClick())
     {
         host.edgeGUI.EndSlotDragging(Enumerable.First<Slot>(base.inputSlots), true);
     }
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:7,代码来源:ExitNode.cs


示例8: SaveToIndex

 private static void SaveToIndex(UnityEditor.MenuCommand mc, int index) {
   PositionSwapper ps = mc.context as PositionSwapper;
   while (ps.Positions.Length <= index) {
     UnityEditor.ArrayUtility.Add<Vector3>(ref ps.Positions, Vector3.zero);
   }
   ps.Positions[index] = ps.transform.localPosition;
 }
开发者ID:2954722256,项目名称:gvr-unity-sdk,代码行数:7,代码来源:PositionSwapper.cs


示例9: SetAttribute

 public static void SetAttribute( UnityEditor.PropertyDrawer drawer, PropertyAttribute attribute )
 {
     FieldInfo fi = TargetType.GetField( "m_Attribute", BindingFlags.NonPublic | BindingFlags.Instance );
     if( fi == null ){
         Debug.Log( "Error, FieldInfo not found" );
         return;
     }
     fi.SetValue( drawer, attribute );
 }
开发者ID:qingsheng1355,项目名称:test,代码行数:9,代码来源:PropertyDrawer.cs


示例10: OnGUI

        public override void OnGUI(Rect position, UnityEditor.SerializedProperty property, GUIContent label)
        {
            string fieldName;
            bool notifyPropertyChanged;
            {
                var attr = this.attribute as InspectorDisplayAttribute;
                fieldName = (attr == null) ? "value" : attr.FieldName;
                notifyPropertyChanged = (attr == null) ? true : attr.NotifyPropertyChanged;
            }

            if (notifyPropertyChanged)
            {
                EditorGUI.BeginChangeCheck();
            }
            var targetSerializedProperty = property.FindPropertyRelative(fieldName);
            if (targetSerializedProperty == null)
            {
                UnityEditor.EditorGUI.LabelField(position, label, new GUIContent() { text = "InspectorDisplay can't find target:" + fieldName });
                if (notifyPropertyChanged)
                {
                    EditorGUI.EndChangeCheck();
                }
                return;
            }
            else
            {
                EmitPropertyField(position, targetSerializedProperty, label);
            }

            if (notifyPropertyChanged)
            {
                if (EditorGUI.EndChangeCheck())
                {
                    var propInfo = fieldInfo.FieldType.GetProperty(fieldName, BindingFlags.IgnoreCase | BindingFlags.GetProperty | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

                    property.serializedObject.ApplyModifiedProperties(); // deserialize to field

                    var paths = property.propertyPath.Split('.'); // X.Y.Z...
                    var attachedComponent = property.serializedObject.targetObject;

                    var targetProp = (paths.Length == 1)
                        ? fieldInfo.GetValue(attachedComponent)
                        : GetValueRecursive(attachedComponent, 0, paths);
                    var modifiedValue = propInfo.GetValue(targetProp, null); // retrieve new value

                    var methodInfo = fieldInfo.FieldType.GetMethod("SetValueAndForceNotify", BindingFlags.IgnoreCase | BindingFlags.InvokeMethod | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
                    if (methodInfo != null)
                    {
                        methodInfo.Invoke(targetProp, new object[] { modifiedValue });
                    }
                }
                else
                {
                    property.serializedObject.ApplyModifiedProperties();
                }
            }
        }
开发者ID:fiskercui,项目名称:AssetBundleSample,代码行数:57,代码来源:InspectorDisplayDrawer.cs


示例11: OnContextMenu

		////////////////////////////////////////
		///////////GUI AND EDITOR STUFF/////////
		////////////////////////////////////////
		#if UNITY_EDITOR

		protected override UnityEditor.GenericMenu OnContextMenu(UnityEditor.GenericMenu menu){

			menu.AddItem( new GUIContent("Breakpoint"), isBreakpoint, ()=> { isBreakpoint = !isBreakpoint; } );
			menu.AddItem (new GUIContent ("Convert to SubTree"), false, ()=> { MakeNestedSubTree(this); });
            if (outConnections.Count > 0){
				menu.AddItem (new GUIContent ("Delete Branch"), false, ()=> { DeleteBranch(this); } );
				menu.AddItem(new GUIContent("Duplicate Branch"), false, ()=> { DuplicateBranch(this, graph); });
			}
			return menu;
		}		
开发者ID:pangaeastudio,项目名称:vrgame-bruceli,代码行数:15,代码来源:BTComposite.cs


示例12: GetInspectedType

 public static Type GetInspectedType( UnityEditor.CustomEditor editor )
 {
     if( m_InspectedType == null )
         m_InspectedType = TargetType.GetField( "m_InspectedType", BindingFlags.NonPublic | BindingFlags.Instance );
     if( m_InspectedType == null ){
         Debug.Log( "FieldInfo Not Found" );
         return null;
     }
     return m_InspectedType.GetValue( editor ) as Type;
 }
开发者ID:qingsheng1355,项目名称:test,代码行数:10,代码来源:CustomEditor.cs


示例13: FindAnimationClips

    // AnimatorController内のステートを取得する
    private List<UnityEditor.Animations.AnimatorState> FindAnimationClips(
		UnityEditor.Animations.AnimatorController animatorController)
    {
        var stateList = new List<UnityEditor.Animations.AnimatorState> ();
        foreach (var layer in animatorController.layers) {
            foreach (var state in layer.stateMachine.states) {
                stateList.Add (state.state);
            }
        }
        return stateList;
    }
开发者ID:satanabe1,项目名称:unity-editor-extensions,代码行数:12,代码来源:EditableAnimatorControllerInspector.cs


示例14: OnContextMenu

 ////////////////////////////////////////
 ///////////GUI AND EDITOR STUFF/////////
 ////////////////////////////////////////
 protected override UnityEditor.GenericMenu OnContextMenu(UnityEditor.GenericMenu menu)
 {
     menu.AddItem( new GUIContent("Breakpoint"), isBreakpoint, ()=> { isBreakpoint = !isBreakpoint; } );
     menu.AddItem (new GUIContent ("Convert to SubTree"), false, ()=> { MakeNestedSubTree(this); });
     if (outConnections.Count > 0){
         menu.AddItem (new GUIContent ("Delete Branch"), false, ()=> { DeleteBranch(this); } );
         menu.AddItem(new GUIContent("Duplicate Branch"), false, ()=> { DuplicateBranch(this, graph); });
     }
     menu = EditorUtils.GetTypeSelectionMenu(typeof(BTComposite), (t)=>{ ReplaceWith(t); }, menu, "Replace");
     return menu;
 }
开发者ID:nemish,项目名称:cubematters,代码行数:14,代码来源:BTComposite.cs


示例15: SetSerializedObject

 public static void SetSerializedObject( UnityEditor.Editor editor, UnityEditor.SerializedObject obj )
 {
     if( m_SerializedObjectFieldInfo == null )
         m_SerializedObjectFieldInfo = TargetType.GetField( "m_SerializedObject",
                                                            BindingFlags.NonPublic | BindingFlags.Instance );
     if( m_SerializedObjectFieldInfo == null ){
         Debug.Log( "FieldInfo Not Found" );
         return;
     }
     m_SerializedObjectFieldInfo.SetValue( editor, obj );
 }
开发者ID:qingsheng1355,项目名称:test,代码行数:11,代码来源:Editor.cs


示例16: OnPostProcessBuild

		public static void OnPostProcessBuild(UnityEditor.BuildTarget buildTarget, string buildPath) {
			string libpdcsharpTargetPath = Path.GetDirectoryName(buildPath) + Path.AltDirectorySeparatorChar + "libpdcsharp.dll";
			string pthreadGC2TargetPath = Path.GetDirectoryName(buildPath) + Path.AltDirectorySeparatorChar + "pthreadGC2.dll";
		
			if (!File.Exists(libpdcsharpTargetPath)) {
				File.Copy(LibpdcsharpPath, libpdcsharpTargetPath);
			}
		
			if (!File.Exists(pthreadGC2TargetPath)) {
				File.Copy(PthreadGC2Path, pthreadGC2TargetPath);
			}
		}
开发者ID:Kartoshka,项目名称:Crabby-Pulse-2,代码行数:12,代码来源:PureDataPluginManager.cs


示例17: OnGUI

 override public void OnGUI(Rect position, MaterialProperty prop, string label,
                            UnityEditor.MaterialEditor editor) {
   EditorGUI.BeginChangeCheck();
   prop.textureValue = editor.TextureProperty(prop, label);
   if (EditorGUI.EndChangeCheck()) {
     if (prop.textureValue == null) {
       (editor.target as Material).DisableKeyword(keywordName + "_ON");
     } else {
       (editor.target as Material).EnableKeyword(keywordName + "_ON");
     }
   }
 }
开发者ID:MaTriXy,项目名称:cardboard-unity,代码行数:12,代码来源:OptionalTextureDrawer.cs


示例18: NodeUI

 public override void NodeUI(UnityEditor.Graphs.GraphGUI host)
 {
     base.graphGUI = host as UnityEditor.Graphs.AnimationStateMachine.GraphGUI;
     Assert.NotNull(base.graphGUI);
     Event current = Event.current;
     if (UnityEditor.Graphs.AnimationStateMachine.Node.IsRightClick())
     {
         GenericMenu menu = new GenericMenu();
         menu.AddItem(new GUIContent("Make Transition"), false, new GenericMenu.MenuFunction(this.MakeTransitionCallback));
         menu.ShowAsContext();
         current.Use();
     }
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:13,代码来源:AnyStateNode.cs


示例19: GetPatchableResourcesPath

    public static string GetPatchableResourcesPath(int iIdx, UnityEditor.BuildTarget eBuildTarget)
    {
        string sPath = GetRootResourcesPath();
        Star.Foundation.CPath.AddRightSlash(ref sPath);
        sPath += "patchable_resources_";
        sPath += iIdx;

        if (eBuildTarget == UnityEditor.BuildTarget.iOS) sPath += "/ios/";
        else if (eBuildTarget == UnityEditor.BuildTarget.Android) sPath += "/android/";
        else sPath += "/windows/";

        return sPath;
    }
开发者ID:supertms,项目名称:WolongYin,代码行数:13,代码来源:AutoBuildCommonUtil.cs


示例20: RefleshClipList

		void RefleshClipList (UnityEditor.Animations.AnimatorController controller)
		{
			if (controller == null)
				return;

			clipList.Clear ();

			var allAsset = AssetDatabase.LoadAllAssetsAtPath (AssetDatabase.GetAssetPath (controller));
			foreach (var asset in allAsset) {
				if (asset is AnimationClip) {
					var removeClip = asset as AnimationClip;
					if (!clipList.Contains (removeClip)) {
						clipList.Add (removeClip);
					}
				}
			}
		}
开发者ID:SeiyaOhtake,项目名称:Manekin_pis,代码行数:17,代码来源:ContainClip.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# UnityEngine类代码示例发布时间:2022-05-24
下一篇:
C# UnityContainer类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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