using System.Collections; using System.Collections.Generic; using UnityEngine; public class EmissiveLightMatching : MonoBehaviour { [SerializeField] private List indexes; private List colors= new List(); [SerializeField] private Light reference; private float initIntensity; private void Awake() { initIntensity = reference.intensity; } // Start is called before the first frame update void Start() { foreach(int index in indexes) { colors.Add(this.gameObject.GetComponent().materials[index].GetColor("_EmissiveColor")); } } // Update is called once per frame void Update() { int x = 0; foreach(int i in indexes) { this.gameObject.GetComponent().materials[i].SetColor("_EmissiveColor", colors[x] * ((10*reference.intensity / initIntensity))); x++; } } }