高亮脚本:可用于使物体高亮

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"); } } }
莫说我穷的叮当响,大袖揽清风。 莫讥我困时无处眠,天地做床被。 莫笑我渴时无美酒,江湖来做壶。
原文地址:https://www.cnblogs.com/huang--wei/p/10062931.html