Quantcast
Channel: Questions in topic: "points-counter"
Viewing all articles
Browse latest Browse all 51

Coin Pickup system carry int into void

$
0
0
So I'm trying to make it so when I touch a **coin** (Sprite, It's a 2D game) it gets destroyed and i get a point up, but the problem is, that it says that *score* does not exist in the *current context*. **UNITY ERROR:** (Assets/_SCRIPTS/TextScore.cs(11,61): error CS0103: The name `score' does not exist in the current context) **CODE:** using UnityEngine; using System.Collections; using UnityEngine.SocialPlatforms.Impl; using UnityEngine.UI; using System.Security.Cryptography.X509Certificates; public class CodeSystem : MonoBehaviour { // Use this for initialization void Start () { } // Update is called once per frame void Update () { } int score = 0; void OnCollisionEnter ( Collider other ) { Debug.Log("Picked up coin!"); if (tag == "Coin") { Debug.Log("Added score!"); score = score + 1; } } }

Viewing all articles
Browse latest Browse all 51

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>