ui-toolkit-manual-code-exam.../create-a-tabbed-menu-for-ru.../TabbedMenu.cs

18 строки
460 B
C#

using UnityEngine;
using UnityEngine.UIElements;
//Inherits from class `MonoBehaviour`. This makes it attachable to a game object as a component.
public class TabbedMenu : MonoBehaviour
{
private TabbedMenuController controller;
private void OnEnable()
{
UIDocument menu = GetComponent<UIDocument>();
VisualElement root = menu.rootVisualElement;
controller = new(root);
controller.RegisterTabCallbacks();
}
}