/// <summary> /// Add object to list of glowing objects to be rendered. /// </summary> public void RegisterObject(GlowObjectLerp _glowObj) { if (!glowingObjects.Contains(_glowObj)) //Inefficient list search, could probably optimize to be prevented at an object-level. My attempt checked script enabled status on object before running this method, but resulted in weird activation bugs { glowingObjects.Add(_glowObj); } }
/// <summary> /// Remove object from list of glowing objects to be rendered. Updates (rebuilds) buffer. /// </summary> public void DeRegisterObject(GlowObjectLerp _glowObj) { glowingObjects.Remove(_glowObj); if (glowingObjects.Count < 1) //Clearing for (almost)zero overhead when there's no active glow { glowBuff.Clear(); } else { RebuildCommandBuffer(); } }