blob: 404dee12ef996fae40e7a158332d0d2934dfe608 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CustomLight : MonoBehaviour
{
// Start is called before the first frame update
void OnEnable()
{
CustomLightRegistry.Instance.Register(this);
}
// Update is called once per frame
void OnDisable()
{
CustomLightRegistry.Instance.Unregister(this);
}
}
public class CustomLightRegistry : Singleton<CustomLightRegistry>
{
private List<CustomLight> m_Lights;
public List<CustomLight> lights
{
get
{
if (m_Lights == null)
m_Lights = new List<CustomLight>();
return m_Lights;
}
}
public void Register(CustomLight renderer)
{
if (!lights.Contains(renderer))
{
lights.Add(renderer);
}
}
public void Unregister(CustomLight renderer)
{
lights.Remove(renderer);
}
}
|