c# - Unity 'score does not exist in the current context' -
so i'm trying make when touch coin (sprite, it's 2d game) gets destroyed , point up, problem is, says score not exist in current context.
unity error: (assets/_scripts/textscore.cs(11,61): error cs0103: name `score' not exist in 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 initialization void start () { } // update called once per frame void update () { } int score = 0; void oncollisionenter ( collider other ) { debug.log("picked coin!"); if (tag == "coin") { debug.log("added score!"); score = score + 1; } } }
Comments
Post a Comment