Created
January 2, 2022 06:41
-
-
Save gegagome/5ae6d94a47f85f0c20d454a29cdd6708 to your computer and use it in GitHub Desktop.
UI Toolkit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEngine.UIElements; | |
public class UiDocumentManager : MonoBehaviour | |
{ | |
UIDocument _uiDocument; | |
[SerializeField] | |
string _visualElementName, _scrollViewName, _ProgressBarName, _bpmLabelName; | |
VisualElement _visualElement; | |
VisualElement _progressBar; | |
ScrollView _scrollView; | |
Label _bpmLabel; | |
void Awake () | |
{ | |
if (_uiDocument = this.GetComponent<UIDocument>()) | |
{ | |
_visualElement = _uiDocument.rootVisualElement.Q(_visualElementName); | |
_progressBar = _uiDocument.rootVisualElement.parent.Q<VisualElement>(_ProgressBarName); | |
_bpmLabel = _uiDocument.rootVisualElement.Q<Label>(_bpmLabelName); | |
_scrollView = _uiDocument.rootVisualElement.Q<ScrollView>(_scrollViewName); | |
} | |
} | |
public VisualElement GetBackground () | |
{ | |
return _visualElement; | |
} | |
public ScrollView GetScrollView () | |
{ | |
return _scrollView; | |
} | |
public VisualElement GetProgressBar () | |
{ | |
return _progressBar; | |
} | |
public Label GetBpmLabel () | |
{ | |
_bpmLabel.text = "llll"; | |
return _bpmLabel; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment