25 lines
544 B
C#
25 lines
544 B
C#
// GameSession.cs
|
|
using System;
|
|
using UnityEngine;
|
|
|
|
public class GameSession : MonoBehaviour
|
|
{
|
|
public static GameSession Instance { get; private set; }
|
|
public string GameId { get; private set; }
|
|
|
|
private void Awake()
|
|
{
|
|
if (Instance == null)
|
|
{
|
|
Instance = this;
|
|
DontDestroyOnLoad(gameObject);
|
|
GameId = Guid.NewGuid().ToString("N");
|
|
Debug.Log($"[GameSession] New GameId: {GameId}");
|
|
}
|
|
else
|
|
{
|
|
Destroy(gameObject);
|
|
}
|
|
}
|
|
}
|