ã¯ããã«
ã©ãããåéã§ãã
UI Toolkitã§ã©ã³ã¿ã¤ã å¦çã«åãã¦ã¤ãã³ãã®ç»é²ãå¤å¤æ´éç¥ã®æ¹æ³ã調ã¹ã¾ããã
ã³ã¼ã«ããã¯ãè¨å®ãã
UIè¦ç´ ã®ãã¦ã¹æ¼ä¸ã®ã¤ãã³ãã®ã³ã¼ã«ããã¯ãè¨å®ããã«ã¯ä»¥ä¸ã®ããã«ã§ãã¾ãã
VisualElement myElement = new VisualElement(); myElement.RegisterCallback<MouseDownEvent>()
å¤ã®å¤æ´ãè³¼èªãã
ãªãã¸ã§ã¯ãã®ä½ç½®ãå¤ãã£ããUIã®Textå¤æ´ãã¦ã
Textãå¤æ´ãã¦ããªãã¸ã§ã¯ãã®ä½ç½®ã移åãããããªã³ã¼ããæ¸ãã¾ããã
RegisterValueChangedCallback()ã使ç¨ãããã¨ã§å¤æ´ãããå¤ãæµãè¾¼ããã¨ãã§ãã¾ãã
public class UITest2 : MonoBehaviour { [SerializeField] private GameObject moveObject; private Vector3Field Vector3Field; void Start() { Vector3Field = GetComponent<UIDocument>().rootVisualElement.Q<Vector3Field>("test-vector3"); Vector3Field.RegisterValueChangedCallback(x => moveObject.transform.position = x.newValue); } void Update() { Vector3Field.value = moveObject.transform.position; } }