Skip to content

Instantly share code, notes, and snippets.

@JArmando
Created June 20, 2019 20:19
Show Gist options
  • Save JArmando/8544270fb3a0aac2d2d6cf282ff49b7d to your computer and use it in GitHub Desktop.
Save JArmando/8544270fb3a0aac2d2d6cf282ff49b7d to your computer and use it in GitHub Desktop.
Static properties for value classes
class Blabler{
string Text {get;set;}
int A {get;set;}
int B {get;set;}
int C {get;set;}
public static Blaber Blah = new Blabler { A = 1, B = 2, C = 3, Text = "Blah" };
public static Blaber Bleh = new Blabler { A = 2, B = 3, C = 4, Text = "Bleh" };
public static Blaber Bluh = new Blabler { A = 44, B = 13, C = 34, Text = "Bluh" };
}
Debug.Log(Blaber.Blah); // This will have A = 1 and Text = "Blah"
Debug.Log(Blaber.Bleh); // This will have A = 2 and Text = "Bleh"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment