This repository has been archived on 2023-09-13. You can view files and clone it, but cannot push or open issues or pull requests.
station_obscurum_unity/Assets/Scripts/Steam/SteamManager.cs
2023-06-01 08:03:48 -07:00

40 lines
868 B
C#

using System;
using Steamworks;
using UnityEngine;
using UnityEngine.Events;
public class SteamManager : MonoBehaviour
{
public uint appId;
public UnityEvent onSteamFailed;
private void Awake()
{
DontDestroyOnLoad(this);
try
{
SteamClient.Init(appId);
Debug.Log("Steam is up and running!");
}
catch (Exception e)
{
Debug.Log(e.Message);
onSteamFailed.Invoke();
}
}
private void OnApplicationQuit()
{
try
{
Debug.Log("Steam is shutting down!");
SteamClient.Shutdown();
}
catch
{
Debug.Log("Steam is not running!");
}
}
}