Files

40 lines
1.2 KiB
C#
Raw Permalink Normal View History

2025-07-13 23:16:20 +08:00
using System.Collections.Generic;
using HighlightPlus;
using UnityEngine;
public class HDRPOutlineMgr: MonoBehaviour
{
public static HDRPOutlineMgr Ins { get; private set; }
[SerializeField] private HighlightProfile outlineProfile;
[SerializeField] private Color outlineColor = Color.yellow;
private static Dictionary<GameObject, List<string>> highlightEvents = new Dictionary<GameObject, List<string>>();
void Awake()
{
Ins = this;
}
public static void StartHighlight(GameObject go)
{
var script = go.GetComponent<HighlightEffect>();
if (script == null)
{
script = go.AddComponent<HighlightEffect>();
}
script.ProfileLoad(Ins.outlineProfile);
script.highlighted = true;
script.UpdateMaterialProperties();
}
public static void StopHighlight(GameObject go)
{
HighlightEffect outline = go.GetComponent<HighlightEffect>();
// Debug.Log ("StopHighlight: " + go.name + " / script: " + script);
if (outline == null) return;
GameObject.DestroyImmediate(outline);
}
}