- Home /
Coin Counting Problem
Ok. I have a script that tells you how many coins are remaining in the level.
scoregui.js
var remaining;
function OnGUI()
{
remaining = GameObject.FindGameObjectsWithTag ("Finish");
GUILayout.Label( remaining + " Coins" + " Remaining");
}
But when I try to figure out how many coin there are it always returns UnityEngine.GameObject[] Coins Remaining. I've checked to make sure that the coins are tagged "Finish" . So what is wrong. Oh here's my
collect.js
function OnCollisionEnter ()
{
Destroy(gameObject);
Debug.Log("Coin Collected");
}
It does recognizes that it collects the coin and destroys it just like it should. Any ideas on what's is wrong?
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613064502im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Setting Scroll View Width GUILayout 1 Answer
Need help displaying score (JavaScript) 1 Answer
GUI countdown when held? 2 Answers
PasswordField help. 1 Answer