#if STEAMWORKSNET using UnityEngine; using Steamworks; namespace MegaKoop.Steam { /// /// Minimal Steam bootstrapper. Keeps SteamAPI initialized and runs callbacks. /// Add this to your bootstrap scene once. /// public class SteamManager : MonoBehaviour { public static SteamManager Instance { get; private set; } public static bool Initialized { get; private set; } private void Awake() { if (Instance != null && Instance != this) { Destroy(gameObject); return; } Instance = this; DontDestroyOnLoad(gameObject); try { Initialized = SteamAPI.Init(); } catch (System.DllNotFoundException e) { Debug.LogError($"[SteamManager] Steamworks DLL not found: {e.Message}"); Initialized = false; } if (!Initialized) { Debug.LogError("[SteamManager] SteamAPI.Init failed. Is Steam running? Is the app configured?"); } } private void Update() { if (Initialized) { SteamAPI.RunCallbacks(); } } private void OnDestroy() { if (Instance == this) { if (Initialized) { SteamAPI.Shutdown(); Initialized = false; } Instance = null; } } } } #else using UnityEngine; namespace MegaKoop.Steam { public class SteamManager : MonoBehaviour { private void Awake() { Debug.LogWarning("[SteamManager] STEAMWORKSNET define not set. Install Steamworks.NET and add Scripting Define Symbol 'STEAMWORKSNET'."); } } } #endif