using GLTFast; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI; public class SelectInColor : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler, IPointerClickHandler { public List _image; private List old= new List(); public float InColor; public float OutColor; // Start is called before the first frame update void Start() { for (int n = 0; n < _image.Count; n++) { old.Add(_image[n].color); } for (int n = 0; n < _image.Count; n++) { _image[n].GetComponent().color = new Vector4(old[n].x, old[n].y, old[n].z, OutColor); } } // Update is called once per frame void Update() { } public void OnPointerClick(PointerEventData eventData) { } public void OnPointerEnter(PointerEventData eventData) { for (int n = 0; n < _image.Count; n++) { _image[n].GetComponent().color = new Vector4(old[n].x, old[n].y, old[n].z, InColor); } } public void OnPointerExit(PointerEventData eventData) { for (int n = 0; n < _image.Count; n++) { _image[n].GetComponent().color = new Vector4(old[n].x, old[n].y, old[n].z, OutColor); } } private void OnDisable() { if (old.Count != 0) { for (int n = 0; n < _image.Count; n++) { _image[n].GetComponent().color = new Vector4(old[n].x, old[n].y, old[n].z, OutColor); } } } }