void OnCollsionEnter(Collision col) { GameObject temp = GameObject.Find("WeightBar"); WeightCounter counter = temp.GetComponent <WeightCounter>(); if (col.gameObject.tag == "pollution") { Destroy(col.gameObject); } }
void Start() { GameObject temp = GameObject.Find("WeightBar"); counter = temp.GetComponent <WeightCounter>(); }