Hi. J’m from poland, so I use translator. Proszę nie patrzeć na błędy. J finished the course JavaScript, but but it was short. I have a problem with the script for the keys. So looks like the script in which you press one begins to execute the code.
function Update () {
if (Input.GetKeyDown("1")){
; //code to do
}
}
I want that when you click one code began to perform, but the next stop. How does the script look like then?
Oh, you want to toggle the script on or off when 1 is pressed?
-Script is off
-player presses 1
-script turns on
-player presses 1
-script turns off
-repeat…
if thats the case, you will need another variable, probably a boolean, to turn ‘on’ and ‘off’ when the player presses 1. Then, instead of turning the script on and off by the player input, you base it off that on/off variable.