I want every time the key is pressed but will add 1 add 5 ¿¿anyone knows why and how to fix this:??
var credit:int=0;
function Update () {
if(Input.GetButtonDown("jugar")){
_root.credit ++;
}
}
result: credit=5; ???
I want every time the key is pressed but will add 1 add 5 ¿¿anyone knows why and how to fix this:??
var credit:int=0;
function Update () {
if(Input.GetButtonDown("jugar")){
_root.credit ++;
}
}
result: credit=5; ???
Probably wrong because i’m a noob at unity
var credit : int = 0;
function Update(){
if(Input.GetButtonDown("Your_Key_Here")){
credit += 1;
}
}
Hope that works
Your script will only add 1 to credit. You probably have added this script 5 times to one or multiple objects in the scene.