So I’m trying to use pick ups and finishing levels to score my Tilting board game, however I’m having trouble with actually getting the score to increase when this is done. I have got script that changes level and removes objects upon trigger, but the increasing score is where I’m hitting a wall, no matter what i try i get errors, any help is appreciated.
using UnityEngine;
using System.Collections;
public class PickUp : MonoBehaviour
{
public int points = 10;
public void OnTriggerEnter(Collider collider)
{
Destroy (this.gameObject);
}
}
This is the script for the pick up objects, so far it can only remove them from the board:
using UnityEngine;
using System.Collections;
public class TiltGUI : MonoBehaviour
{
public static int totalScore;
void OnGUI()
{
GUI.Label(new Rect(10,20,100,30), "Score: " + totalScore);
}
}
This puts the score value on the top of the screen, although at the moment it remains at 0