void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } }
private void btnWrite_Click(object sender, EventArgs e) { IWriter writer; if (rbTxt.Checked) { writer = new TextWriter(_products); } else { writer = new JsonWriter(_products); } var writingManager = new WritingManager(); writingManager.WriteFile(writer); }