public void Awake() //This makes The master object survive the change in scene and creates the Deck Numbers { if (MasterObject != null && MasterObject != this) { Destroy(gameObject); } else { MasterObject = this; DontDestroyOnLoad(gameObject); } // complete the card arrays Numbers = new Card[] { Zero, One, Two, Three, Four, Five, Six, Seven, Eight }; Colors = new Card[] { White, Yellow, Brown, Orange, Red, Blue, Green, Black, Purple }; //put them into their respective decks NumbersDecks = new Deck(Numbers, 0, "Numbers"); ColorsDecks = new Deck(Colors, 1, "Colors"); // Complete an array of decks AllDecks = new Deck[] { NumbersDecks, ColorsDecks }; SaveObject saveObject = new SaveObject { TextingText = 0 }; string json = JsonUtility.ToJson(saveObject); Debug.Log(json); SaveObject loadedSaveObject = JsonUtility.FromJson <SaveObject>(json); Debug.Log(loadedSaveObject.TextingText); }
void Awake() // Finds the master object and its script { //MasterScript = Master_Script.MasterObject; MasterObject = GameObject.FindGameObjectWithTag("Master"); MasterScript = MasterObject.GetComponent <Master_Script>(); }
void Awake() // Finds the master object and its script { MasterScript = Master_Script.MasterObject; Options_text.text = "Empty"; }
void Awake() //(cleaned) Finds the master object and its script { MasterScript = Master_Script.MasterObject; GameManager = GameObject.Find("GameManager"); GameManagerScript = GameManager.GetComponent <GameManagerScript>(); }