From c47b92e92cf33ae8bf2f38929e137294397e4735 Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 7 Apr 2021 21:33:14 +0800 Subject: +init --- .../Samples/Demo/UIEffect_Demo_PropertyControl.cs | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Assets/Samples/Demo/UIEffect_Demo_PropertyControl.cs (limited to 'Assets/Samples/Demo/UIEffect_Demo_PropertyControl.cs') 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]); + } + } +} -- cgit v1.1-26-g67d0