24 lines
		
	
	
		
			381 B
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			24 lines
		
	
	
		
			381 B
		
	
	
	
		
			C#
		
	
	
	
using System.Collections;
 | 
						|
using System.Collections.Generic;
 | 
						|
 | 
						|
using Godot;
 | 
						|
 | 
						|
namespace Rokojori
 | 
						|
{
 | 
						|
  public class Unique<N> where N:Node
 | 
						|
  {
 | 
						|
    private static N _singleton;
 | 
						|
 | 
						|
    public static N Get()
 | 
						|
    {
 | 
						|
      if ( _singleton != null )
 | 
						|
      {
 | 
						|
        return _singleton;
 | 
						|
      }
 | 
						|
 | 
						|
      _singleton = Nodes.GetAnyChild<N>( Root.Window() );
 | 
						|
      
 | 
						|
      return _singleton;
 | 
						|
    }
 | 
						|
  }
 | 
						|
} |