void OnTriggerEnter2D(Collider2D coll) { if (coll != null) { Lead lead = coll.gameObject.GetComponent <Lead>(); if (lead != null) { lead.NewCart(); GameObject trainobj = GameObject.Find("Train"); Train train = trainobj.GetComponent <Train> (); train.CreateMoney(); Destroy(this.gameObject); } } }