quantum-space-buddies/QSB/Utility/DebugCameraSettings.cs

39 lines
799 B
C#
Raw Normal View History

2021-12-30 13:55:41 +00:00
using UnityEngine;
namespace QSB.Utility
2021-12-30 13:55:41 +00:00
{
internal class DebugCameraSettings : MonoBehaviour, IAddComponentOnStart
2021-12-30 13:55:41 +00:00
{
public static void UpdateFromDebugSetting()
2021-12-30 13:55:41 +00:00
{
if (QSBCore.DebugSettings.GreySkybox)
2021-12-30 13:55:41 +00:00
{
QSBSceneManager.OnSceneLoaded += OnSceneLoaded;
if (Camera.main)
{
Camera.main.backgroundColor = Color.gray;
}
2021-12-30 13:55:41 +00:00
}
else
2022-01-18 15:50:20 -08:00
{
QSBSceneManager.OnSceneLoaded -= OnSceneLoaded;
if (Camera.main)
{
Camera.main.backgroundColor = _origColor;
}
2022-01-18 15:50:20 -08:00
}
}
private static Color _origColor;
2022-01-18 15:50:20 -08:00
private void Awake()
{
_origColor = Camera.main.backgroundColor;
UpdateFromDebugSetting();
Destroy(this);
}
private static void OnSceneLoaded(OWScene arg1, OWScene arg2, bool arg3)
=> Camera.main.backgroundColor = Color.gray;
}
}