using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using XRTool.Util; using XRTool.WorldUI; public class Change3DIconColor : MonoBehaviour { public Color originalColor; public Color changeColor; private Renderer back2XRIcon3D; void Start() { var toggle = GetComponent(); toggle.onValueChanged.AddListener(OnColorChange); var obj = UnityUtil.GetBreadthChild(transform, "Back2XRIcon3D"); if (obj) { back2XRIcon3D = obj.BodyRender; } OnColorChange(toggle.isOn); } private void OnColorChange(bool isOn) { if (back2XRIcon3D) { UnityUtil.ChangeMateColor(back2XRIcon3D, isOn ? changeColor : originalColor, "_Color"); } } }