Unity 6.3
0 онлайн 90 гостей 3 в системе
Вход

Editor.OnGetFrameBounds()

Описание

Получить настраиваемые границы для цели этого редактора.

Используйте этот метод для получения границ для пользовательского окна, полученного из Editor класс. Этот метод всегда применяется вместе с Editor.HasFrameBounds которая либо возвращает true, либо false, в зависимости от реализации.

using UnityEngine;
using UnityEditor;

// This example traverses all bones in the hierarchy and calculates bounds for the entire object public class GameObjectEditorWindow: Editor { private bool HasFrameBounds() { // the result of this function depends on implementation // it will most likely be used to evaluate whether bounds // can exist for the targets of this Editor Window return Selection.objects.Length > 0; }

public Bounds OnGetFrameBounds() { Transform bone = Selection.activeTransform; Bounds bounds = new Bounds(bone.position, new Vector3(0, 0, 0)); foreach (Transform child in bone) bounds.Encapsulate(child.position);

if (bone.parent) bounds.Encapsulate(bone.parent.position);

return bounds; } }