Scoring to go up by 1 after pickup is collected?
First of all, I would like to introduce myself. I'm new to Unity and I have been wanting to create a game for some time. I've only had the time to do recently.
Anyway, I've created my game, visually, so the background is there, platforms, pickups etc; and would like to have it so that when one of my pickups are collected the score increases by one. However, no matter how hard I try, I cannot find anything related to helping me, nor can I figure it out myself.
I currently have two scripts (I'm coding in C#), the PickupScript which makes the pickup disappear when the character hits it; using UnityEngine; using System.Collections;
public class PickupScript : MonoBehaviour {
void OnTriggerEnter2D(Collider2D other){
if (other.gameObject.tag == "Player") {
Destroy (gameObject);
}
}
public void ScoreSystem(int currency){ (*Not too sure about this?*)
}
Any my ScoreScript that creates a GUI Label to display the score; using UnityEngine; using System.Collections;
public class ScoreScript : MonoBehaviour {
void OnGUI(){
GUI.Label (new Rect (10, 10, 100, 30), "Score:0");
}
The game works perfectly fine with the code as it is at the moment with no compiler errors. The pickups react how I'd like them to react. If anybody has any help that can aid me coding the score so that when a pickup is collected the score increases by one, that would be great!
Thanks in advance!