Created
April 17, 2017 00:19
-
-
Save matrixcloud/62fd49d4bfe3a4dc9fba3895b10ea540 to your computer and use it in GitHub Desktop.
c# singlton
This file contains 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
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