导入R3,简单实现数据绑定UI,以及双向绑定
This commit is contained in:
19
Assets/GameScripts/Main/SimpleR3Test.cs
Normal file
19
Assets/GameScripts/Main/SimpleR3Test.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using R3;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class SimpleR3Test : MonoBehaviour
|
||||
{
|
||||
BindableReactiveProperty<float> value = new(0);
|
||||
|
||||
public InputField inputField;
|
||||
public Scrollbar scrollbar;
|
||||
|
||||
|
||||
void Start()
|
||||
{
|
||||
value.BindToScrollbar(scrollbar).AddTo(this);
|
||||
value.BindToInputField(inputField).AddTo(this);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user