private void Start() { playerNear = false; scoreText.color = Color.red; foreach (GameObject metric in GameObject.FindGameObjectsWithTag("metrics")) { if (metric.name.Equals(metricName)) { coinMetric = metric.GetComponent <coinUpdate>(); } } }
// Use this for initialization void Start() { layerMask = 1 << 8; goalMask = 1 << 11; blueCoinCount = 0; greenCoinCount = 0; foreach (GameObject metric in GameObject.FindGameObjectsWithTag("metrics")) { if (metric.name.Equals("Score")) { blueScore = metric.GetComponent <coinUpdate>(); } if (metric.name.Equals("greenScore")) { greenScore = metric.GetComponent <coinUpdate> (); } } }