Strip UI debug stuff from the game
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using System.Collections;
|
||||
using AppleHills.Core.Settings;
|
||||
using Core;
|
||||
|
||||
public class DebugUIMessage : MonoBehaviour
|
||||
{
|
||||
@@ -17,6 +19,14 @@ public class DebugUIMessage : MonoBehaviour
|
||||
/// <param name="displayColor"></param>
|
||||
public static void Show(string message, Color displayColor, float duration = 2f)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
var divingDevSettings = DeveloperSettingsProvider.Instance.GetSettings<DebugSettings>();
|
||||
if (divingDevSettings && !divingDevSettings.ShowDebugUiMessages)
|
||||
{
|
||||
Logging.Debug($"[DebugUIMessage] Loggig debug message: {message}");
|
||||
return;
|
||||
}
|
||||
|
||||
if (instance == null)
|
||||
{
|
||||
var go = new GameObject("DebugUIMessage");
|
||||
@@ -25,6 +35,9 @@ public class DebugUIMessage : MonoBehaviour
|
||||
DontDestroyOnLoad(go);
|
||||
}
|
||||
instance.ShowMessage(message, duration, displayColor);
|
||||
# else
|
||||
Logging.Debug($"[DebugUIMessage] Loggig debug message: {message}");
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -21,31 +21,12 @@ namespace AppleHills.Core.Settings
|
||||
[CreateAssetMenu(fileName = "DebugSettings", menuName = "AppleHills/Developer Settings/Debug", order = 2)]
|
||||
public class DebugSettings : BaseDeveloperSettings
|
||||
{
|
||||
[Header("Visualization")]
|
||||
[Tooltip("Show colliders for game objects")]
|
||||
[SerializeField] private bool showColliders = false;
|
||||
|
||||
[Tooltip("Show performance statistics (FPS, memory usage, etc.)")]
|
||||
[SerializeField] private bool showPerformanceStats = false;
|
||||
|
||||
[Header("Logging")]
|
||||
[Tooltip("Level of detail for logging")]
|
||||
[SerializeField] private LogVerbosity logLevel = LogVerbosity.Warnings;
|
||||
|
||||
[Header("Gameplay")]
|
||||
[Tooltip("Make player invulnerable and ignore gameplay restrictions")]
|
||||
[SerializeField] private bool godMode = false;
|
||||
|
||||
[Tooltip("Global time scale for debugging animations and effects")]
|
||||
[Range(0.1f, 10f)]
|
||||
[SerializeField] private float timeScale = 1.0f;
|
||||
[Header("Visual Debugging Options")]
|
||||
[Tooltip("Should debug messages be show on screen in Editor")]
|
||||
[SerializeField] private bool showDebugUiMessages = false;
|
||||
|
||||
// Property getters
|
||||
public bool ShowColliders => showColliders;
|
||||
public bool ShowPerformanceStats => showPerformanceStats;
|
||||
public LogVerbosity LogLevel => logLevel;
|
||||
public bool GodMode => godMode;
|
||||
public float TimeScale => timeScale;
|
||||
public bool ShowDebugUiMessages => showDebugUiMessages;
|
||||
|
||||
public override void OnValidate()
|
||||
{
|
||||
@@ -54,8 +35,7 @@ namespace AppleHills.Core.Settings
|
||||
// Apply any immediate effects when values change in the editor
|
||||
if (Application.isPlaying)
|
||||
{
|
||||
// Set time scale directly when changed in editor
|
||||
Time.timeScale = timeScale;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user