Advertisement
corp0

Untitled

Nov 20th, 2021
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.33 KB | None | 0 0
  1. using Godot;
  2.  
  3. public class SingletonThing: Node
  4. {
  5.     private static SingletonThing instance;
  6.     public static SingletonThing Instance => instance;
  7.  
  8.     public override void _Ready()
  9.     {
  10.         instance = this;
  11.     }
  12.  
  13.     public string SomeField = "My field";
  14.    
  15.     public void SomeMethod()
  16.     {
  17.         GD.print("Hello from the singleton!");
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement