diff options
author | chai <chaifix@163.com> | 2021-04-07 21:33:14 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-04-07 21:33:14 +0800 |
commit | c47b92e92cf33ae8bf2f38929e137294397e4735 (patch) | |
tree | c67ae3419eaf15e84f1679186e107f598de33978 /Assets/Samples/Demo/UIEffect_Demo_PropertyControl.cs |
Diffstat (limited to 'Assets/Samples/Demo/UIEffect_Demo_PropertyControl.cs')
-rw-r--r-- | Assets/Samples/Demo/UIEffect_Demo_PropertyControl.cs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Assets/Samples/Demo/UIEffect_Demo_PropertyControl.cs b/Assets/Samples/Demo/UIEffect_Demo_PropertyControl.cs new file mode 100644 index 0000000..4d6144f --- /dev/null +++ b/Assets/Samples/Demo/UIEffect_Demo_PropertyControl.cs @@ -0,0 +1,25 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.Events; +using UnityEngine.UI; + +public class UIEffect_Demo_PropertyControl : MonoBehaviour +{ + [SerializeField] private string m_PropertyName; + [SerializeField] private Object[] m_Objects; + + public void ChangeValue(int value) + { + foreach (var o in m_Objects) + { + if (!o) continue; + + var p = o.GetType().GetProperty(m_PropertyName); + Debug.LogFormat("{0} {1} {2}", o.GetType(), m_PropertyName, p); + + if (p == null) continue; + p.SetValue(o, value, new object[0]); + } + } +} |