using System.Collections; using System.Collections.Generic; using UnityEngine; [ExecuteInEditMode] public class OutlineManager : MonoBehaviour { public static OutlineManager instance; public bool m_EnableOutline = true; public float m_SampleDistance = 0.01f; public Color m_OutlineColor = Color.white; public List m_RenderList = new List(); public Color m_OutlineColorEnemy = Color.red; public List m_RenderListEnemy = new List(); // Start is called before the first frame update void OnEnable() { instance = this; } public void AutoAddFromObj(GameObject obj, bool isEnemy) { var renders = obj.GetComponentsInChildren(); if (isEnemy) { m_RenderListEnemy.AddRange(renders); } else { m_RenderList.AddRange(renders); } } public void RemoveRenderer(Renderer r, bool isEnemy) { if (isEnemy) { m_RenderListEnemy.Remove(r); } else { m_RenderList.Remove(r); } } public void AddRenderer(Renderer r, bool isEnemy) { if (r.sharedMaterials.Length > 1) return; if (isEnemy) { m_RenderListEnemy.Add(r); } else { m_RenderList.Add(r); } } }