using System.Collections; using System.Collections.Generic; using UnityEngine; public class HighLight { private static HighLight instance ; public static HighLight Instance { get { if (instance==null) { instance = new HighLight(); } return instance; } } //加高亮 public void MaskEffecOn(GameObject obj,Color color)//可自定义颜色 { if (obj==null) return; Material[] material = obj.GetComponent<Renderer>().materials; foreach (Material Mat in material) { Mat.EnableKeyword("_EMISSION"); // Mat.SetColor("_EmissionColor", new Color(0f,0.4568f, 0.7279f));
Mat.SetColor("_EmissionColor", color); } } public void MaskEffectOff(GameObject obj) { if (obj==null) { return; } Material[] material = obj.GetComponent<Renderer>().materials; foreach (Material Mat in material) { Mat.DisableKeyword("_EMISSION"); } } }