rj-action-library/Runtime/Tools/Singleton.cs

24 lines
355 B
C#
Raw Normal View History

2025-01-08 18:46:17 +00:00
using System.Collections;
using System.Collections.Generic;
using Godot;
namespace Rokojori
{
public class Singleton<T> where T:new()
{
private static T _singleton;
public static T Get()
{
if ( _singleton != null )
{
return _singleton;
}
_singleton = new T();
return _singleton;
}
}
}