Coin Pickup system carry int into void
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;
}
}
}
Answer by Jessespike · Feb 05, 2016 at 05:40 PM
void OnCollisionEnter ( Collider other )
Change to:
void OnCollisionEnter ( Collision other )
http://docs.unity3d.com/ScriptReference/Collider.OnCollisionEnter.html
Your answer
Follow this Question
Related Questions
how to create a score multiplier? 0 Answers
In the next scene show the score using player prefab before next level 1 Answer
Vectors side determing by a line. Please help me out !!!! 0 Answers
Implementing multiple choice question into game 1 Answer
How do i Instantiate sub-Points with in Multiple Points?? 0 Answers