using UnityEngine;
using System.Collections;
public class scor : MonoBehaviour { //scor was a mistake sorry
float playerScore = 0;
void OnTriggerEnter(other Collider){
playerScore += 1;
}
// Update is called once per frame
void Update ()
{
//Method to increase score though other scripts:
//Like collectibles, etc.
public void IncreaseScore(int amount)
{
playerScore += amount;
}
void OnDisable()
{
//Look to store somewhere else. Like a packet to persist with dont destroy on load.
PlayerPrefs.SetInt ("Score", (int)(playerScore*100));
}
void OnGUI()
{
GUI.Label (new Rect (10, 10, 100, 30), "Score " + (int)(playerScore * 100));
}
}
I have tried lots of this does any one know how to fix it?
You are missing a closing brace on your Update() Function. Like so.
void Update()
{
}