I try to get on the mouse down work, I have find a example but its not work this is my error Assets/scripts/onclickx.js(13,5): BCE0044: expecting EOF, found '}'.
This is my code
import UnityEngine.UI;
import UnityEngine.EventSystems;
if(Input.GetMouseDown(0){
// Whatever you want it to do.
ScoreSystem.drinks -= 1;
mySlider = GameObject.Find("water").GetComponent(UnityEngine.UI.Slider);
counter.water = counter.water += 10
mySlider.value = counter.water;
}
this is the script for the counter.js
import UnityEngine.UI;
var mySlider: UnityEngine.UI.Slider;
var water = 90;
function Start () {
// substitute 'sliderName' with the literal name
// of your slider as it appears in the hierarchy:
mySlider = GameObject.Find("water").GetComponent(UnityEngine.UI.Slider);
mySlider.value = water;
}
function OnTriggerEnter(other : Collider)
{
Destroy(gameObject);
ScoreSystem.drinks += 1;
mySlider.value += 10;
// insert desired variable here in place of 'n'
// slider will automagically adjust to display new value
}
and this is the code for my score system
static var myScore = 0;
static var score = 0;
static var money = 0;
static var level = 0;
static var drinks = 0;
public var guiSkin : GUISkin;
function OnGUI()
{
GUI.skin = guiSkin;
GUI.contentColor = Color.green;
GUI.Label(Rect((Screen.width / 2) - 60,15, 200, 30), "Score: " + score);
GUI.Label(Rect((Screen.width / 2) - 60,30, 200, 30), "Money: " + money);
GUI.Label(Rect((Screen.width / 2) - 60,42, 200, 30), "Level: " + level);
GUI.Label(Rect((Screen.width / 2) - -320,25, 200, 30), "Drinks: " + drinks);
}