// Update is called once per frame void Update() { anotherScript = GetComponent <plantCollector>(); myGameScore.text = "Score : " + anotherScript.scoreOfGame; remainingPlants.text = "Plants :" + anotherScript.plantCount; remainingPanels.text = "Panels :" + anotherScript.panelCount; }
private void OnTriggerEnter(Collider other) { if (other.gameObject.layer == 13) { plantCollector plantcollector = GetComponent <plantCollector>(); plantcollector.scoreOfGame += 5; Destroy(other.gameObject); } }