public static single getinstance() { if (me == null) { me = new single(); } return(me); }
static void Main(string[] args) { single one = single.getinstance(); one.PrintA(); one.a = 55; single two = single.getinstance(); two.PrintA(); }
private void Awake() { if (single.singleton == null) { single.singleton = this; DontDestroyOnLoad(this); } else { Destroy(gameObject); } }
public void Deserialize(MemoryEndianBinaryReader reader) { FieldMark fm = new FieldMark(1); reader.Read(fm.getData()); if (fm.ReadMark()) { x = reader.ReadSingle(); } if (fm.ReadMark()) { y = reader.ReadSingle(); } if (fm.ReadMark()) { z = reader.ReadSingle(); } }