Created
September 2, 2015 20:45
-
-
Save unitycoder/407d9929d19c475c17ba to your computer and use it in GitHub Desktop.
Public Static Get Set property
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static int _myNumber; | |
public static int MyNumber | |
{ | |
get | |
{ | |
// add custom logic here when value is queried | |
return _myNumber; | |
} | |
set | |
{ | |
// add custom logic here when value is changed | |
_myNumber = value; | |
} | |
} | |
// call from separate script: ClassName.MyNumber++; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment