using System; using System.Diagnostics; namespace Ingvar.LiveWatch { public static partial class Watch { public static event Action OnClearedAll; public static event Action OnDestroyedAll; public static WatchReference GetOrAdd(string path) { #if UNITY_EDITOR || LIVE_WATCH_BUILD return WatchServices.ReferenceCreator.GetOrAdd(path); #else return WatchServices.ReferenceCreator.Empty(); #endif } public static WatchReference PushEmpty(string path) { #if UNITY_EDITOR || LIVE_WATCH_BUILD return WatchServices.ReferenceCreator.GetOrAdd(path).PushEmptyValue(); #else return WatchServices.ReferenceCreator.Empty(); #endif } public static void UpdateAll() { #if UNITY_EDITOR || LIVE_WATCH_BUILD WatchServices.VariableUpdater.UpdateAll(); #endif } public static void ClearAll() { #if UNITY_EDITOR || LIVE_WATCH_BUILD WatchServices.VariableUpdater.ClearAll(); OnClearedAll?.Invoke(); #endif } public static void DestroyAll() { #if UNITY_EDITOR || LIVE_WATCH_BUILD WatchServices.VariableUpdater.ClearAll(); Watches.Clear(); OnDestroyedAll?.Invoke(); #endif } } }