void Start() { if (instance == null) { //If I am the first instance, make me the Singleton instance = this; DontDestroyOnLoad(this); //dialogBoxUI = GetComponent<GameObject>(); } else { //If a Singleton already exists and you find //another reference in scene, destroy it! if (this != instance) { Destroy(this.gameObject); } } }
// Use this for initialization void Start() { keySprite = transform.GetChild(0).gameObject; keySprite.SetActive(false); lines2 = new speakingScript(); lines2.lines = new string[5]; lines2.lines[0] = "Hi there my g"; lines2.lines[1] = "Guess what we're doing"; lines2.lines[2] = "OLD ENGLIISSSSH"; lines2.lines[3] = "<id>Capsule"; lines2.lines[4] = "That shit is garbage my dude"; charID = new string[2]; charID[0] = "mike"; charID[1] = "ike"; dialogRef = dialogManager.Instance; lines2.length = lines2.lines.Length; json = JsonUtility.ToJson(lines2); print(json); File.WriteAllText(file, json); }