当前位置: 首页>>代码示例>>C#>>正文


C# GameObject.GetHierarchyDepth方法代码示例

本文整理汇总了C#中UnityEngine.GameObject.GetHierarchyDepth方法的典型用法代码示例。如果您正苦于以下问题:C# GameObject.GetHierarchyDepth方法的具体用法?C# GameObject.GetHierarchyDepth怎么用?C# GameObject.GetHierarchyDepth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnityEngine.GameObject的用法示例。


在下文中一共展示了GameObject.GetHierarchyDepth方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ShowFolderButton

		void ShowFolderButton(GameObject gameObject, Rect selectionrect) {
			#if UNITY_EDITOR
			Texture folderIcon = UnityEditor.EditorGUIUtility.IconContent("Project").image;
			float width = selectionrect.width;
			selectionrect.width = 30;
			selectionrect.height = 16;
			selectionrect.x = width - 2 + gameObject.GetHierarchyDepth() * 14;
			selectionrect.height += 1;
			GUIStyle style = new GUIStyle("MiniToolbarButtonLeft");
			style.fixedHeight += 1;
			style.contentOffset = new Vector2(-4, 0);
			style.clipping = TextClipping.Overflow;
			
			if (GUI.Button(selectionrect, folderIcon, style)) {
				List<Object> selectedGameObjects = new List<Object>(UnityEditor.Selection.objects);
				
				if (selection.Contains(gameObject)) {
					selectedGameObjects.Remove(gameObject);
				}
				
				selectedGameObjects.AddRange(gameObject.GetChildrenRecursive());
				foreach (GameObject folder in pureData.hierarchyManager.folderStructure) {
					if (selectedGameObjects.Contains(folder)) {
						selectedGameObjects.Remove(folder);
					}
				}
				
				UnityEditor.Selection.objects = selectedGameObjects.ToArray();
			}
			#endif
		}
开发者ID:Kartoshka,项目名称:Crabby-Pulse-2,代码行数:31,代码来源:PureDataEditorHelper.cs

示例2: ShowPreviewButton

		void ShowPreviewButton(PureDataSetup setup, GameObject gameObject, Rect selectionrect) {
			#if UNITY_EDITOR
			Texture previewIcon = UnityEditor.EditorGUIUtility.ObjectContent(null, typeof(AudioSource)).image;
			PureDataInfo info = setup.Info;
			float width = selectionrect.width;
			selectionrect.width = 30;
			selectionrect.height = 16;
			selectionrect.x = width - 2 + gameObject.GetHierarchyDepth() * 14;
			selectionrect.height += 1;
			GUIStyle style = new GUIStyle("MiniToolbarButtonLeft");
			style.fixedHeight += 1;
			style.contentOffset = new Vector2(-4, 0);
			style.clipping = TextClipping.Overflow;
					
			if (GUI.Button(selectionrect, previewIcon, style)) {
				UnityEditor.Selection.activeObject = gameObject;
						
				if (previewAudioSource != null) {
					previewAudioSource.gameObject.Remove();
				}
						
				previewAudioSource = setup.Clip.PlayOnListener();
				if (previewAudioSource != null) {
					previewAudioSource.volume = info.volume + info.volume * Random.Range(-info.randomVolume, info.randomVolume);
					previewAudioSource.pitch = info.pitch + info.pitch * Random.Range(-info.randomPitch, info.randomPitch);
					previewAudioSource.time = previewAudioSource.pitch >= 0 ? previewAudioSource.clip.length * info.playRangeStart : previewAudioSource.clip.length * Mathf.Min(info.playRangeEnd, 0.99999F);
					previewStopTime = previewAudioSource.pitch >= 0 ? previewAudioSource.clip.length * info.playRangeEnd : previewAudioSource.clip.length * info.playRangeStart;
					routine = DestroyAfterPlaying(previewAudioSource);
				}
			}
			else if (Event.current.isMouse && Event.current.type == EventType.mouseDown) {
				if (previewAudioSource != null) {
					previewAudioSource.gameObject.Remove();
				}
				routine = null;
			}
			#endif
		}
开发者ID:Kartoshka,项目名称:Crabby-Pulse-2,代码行数:38,代码来源:PureDataEditorHelper.cs

示例3: ShowPureDataIcon

		void ShowPureDataIcon(GameObject gameObject, Rect selectionrect) {
			pureDataIcon = pureDataIcon ?? HelperFunctions.LoadAssetInFolder<Texture>("pd.png", "Magicolo/AudioTools/PureData");
			float width = selectionrect.width;
			selectionrect.width = 16;
			selectionrect.height = 16;
			
			if (pureDataIcon != null) {
				selectionrect.x = width - 4 + gameObject.GetHierarchyDepth() * 14;
				GUI.DrawTexture(selectionrect, pureDataIcon);
			}
		}
开发者ID:Kartoshka,项目名称:Crabby-Pulse-2,代码行数:11,代码来源:PureDataEditorHelper.cs


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