本文整理汇总了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
}
示例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
}
示例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);
}
}