Skip to content

Instantly share code, notes, and snippets.

@matrixcloud
Created April 17, 2017 00:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matrixcloud/62fd49d4bfe3a4dc9fba3895b10ea540 to your computer and use it in GitHub Desktop.
Save matrixcloud/62fd49d4bfe3a4dc9fba3895b10ea540 to your computer and use it in GitHub Desktop.
c# singlton
public class ViewMapper<T> where T: BaseView {
private static T _ins;
public static T Instance {
get { return _ins; }
set {
if (_ins != null) {
GameObject.DestroyImmediate(_ins.gameObject);
}
_ins = value;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment