private void Start() { try { goalText = FindObjectOfType <GoalTextOnline>().GetComponent <GoalTextOnline>(); counter = FindObjectOfType <TurnCounter>().GetComponent <TurnCounter>(); soccer = FindObjectOfType <SoccerSpeedControl>().GetComponent <SoccerSpeedControl>(); } catch (Exception e) { //Avoid crash } //Debug data remove //PlayerPrefs.DeleteAll(); }
private void Update() { if (goalText == null || counter == null || soccer == null) { try { goalText = FindObjectOfType <GoalTextOnline>().GetComponent <GoalTextOnline>(); counter = FindObjectOfType <TurnCounter>().GetComponent <TurnCounter>(); soccer = FindObjectOfType <SoccerSpeedControl>().GetComponent <SoccerSpeedControl>(); } catch (Exception e) { //Avoid crash } } }