void Start() { masterSystem = FindObjectOfType <CatHolder>(); if (masterSystem == null) { GameObject tmp = new GameObject(); tmp.AddComponent <CatHolder>(); masterSystem = tmp.GetComponent <CatHolder>(); } pogo = masterSystem.pogo; life = masterSystem.life; speed = masterSystem.speed; check = masterSystem.check; hasToy = masterSystem.hasToy; }
private void Awake() { if (_instance == null) { _instance = this; DontDestroyOnLoad(this.gameObject); pogo = 0; life = 9; speed = 9.0f; check = 0f; hasToy = false; } else { Destroy(this.gameObject); } }