Hi, im very new with unity, I have a problem with my games…
example problem: I have score 200 on my old stage, but when I load stage score back to 0 but if I hit coin score jump from 0 to 300 (1 coin get score 100), what I want is score in load stage same as current old stage score 200 not 0.
heres my script Skor.js its atached on empty game object
static var score : int = 0;
var guiScore : GUIText;
static var teks = false;
function LateUpdate()
{
if(teks)
{
guiScore.text = "Score: " + score;
teks = false;
}
}
here is my koin.js score atached to coin object
var rotateSpeed : float = 150.0; //Your speed
var efek : Transform;
function Update () //The update function will trigger your object to make it rotate
{
transform.Rotate (rotateSpeed * Time.deltaTime, 0.0, 0.0); //It never stops rotating.
}
function OnTriggerEnter( hit : Collider )
{
if(hit.gameObject.tag == "worm")
{
Skor.score += 100;
Skor.teks = true;
var exp = Instantiate(efek, gameObject.transform.position, Quaternion.identity);
Destroy(gameObject);
}
}
I alredy heard about playerperfs but I dont know how to applied it to my script as im very new with unity and javascript.
suggest you search on here for literally 100s of questions on Player.Prefs you should be able to find many, many examples of what you want
– FattieI already search anything and applied on my script and its still not working.
– Jackolanten