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

40 lines
868 B
C#
Raw Permalink Normal View History

2023-06-01 17:03:48 +02:00
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!");
}
}
}