-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathBSExtraColorPresetsController.cs
91 lines (78 loc) · 2.79 KB
/
BSExtraColorPresetsController.cs
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
namespace BSExtraColorPresets
{
/// <summary>
/// Monobehaviours (scripts) are added to GameObjects.
/// For a full list of Messages a Monobehaviour can receive from the game, see https://docs.unity3d.com/ScriptReference/MonoBehaviour.html.
/// </summary>
public class BSExtraColorPresetsController : MonoBehaviour
{
public static BSExtraColorPresetsController Instance { get; private set; }
// These methods are automatically called by Unity, you should remove any you aren't using.
#region Monobehaviour Messages
/// <summary>
/// Only ever called once, mainly used to initialize variables.
/// </summary>
private void Awake()
{
// For this particular MonoBehaviour, we only want one instance to exist at any time, so store a reference to it in a static property
// and destroy any that are created while one already exists.
if (Instance != null)
{
Plugin.Log?.Warn($"Instance of {GetType().Name} already exists, destroying.");
GameObject.DestroyImmediate(this);
return;
}
GameObject.DontDestroyOnLoad(this); // Don't destroy this object on scene changes
Instance = this;
Plugin.Log?.Debug($"{name}: Awake()");
}
/// <summary>
/// Only ever called once on the first frame the script is Enabled. Start is called after any other script's Awake() and before Update().
/// </summary>
private void Start()
{
}
/// <summary>
/// Called every frame if the script is enabled.
/// </summary>
private void Update()
{
}
/// <summary>
/// Called every frame after every other enabled script's Update().
/// </summary>
private void LateUpdate()
{
}
/// <summary>
/// Called when the script becomes enabled and active
/// </summary>
private void OnEnable()
{
}
/// <summary>
/// Called when the script becomes disabled or when it is being destroyed.
/// </summary>
private void OnDisable()
{
}
/// <summary>
/// Called when the script is being destroyed.
/// </summary>
private void OnDestroy()
{
Plugin.Log?.Debug($"{name}: OnDestroy()");
if (Instance == this)
Instance = null; // This MonoBehaviour is being destroyed, so set the static instance property to null.
}
#endregion
}
}