unpause script

Hi i’am making a strategy game and i have run into a problem what i want do do is when i press space the army stops moving, but the problem is when i want the army to start moving again because i can’t find a way to make it start moving any help would be appreciated :slight_smile: i have got the code which i am working on.

Start script : Input.GetButtonDown(“Jump”))GetComponent(“Follow Camera part 2”).enabled = false;

stop script : Input.GetButtonDown(“Fire1”))GetComponent(“Follow Camera part 2”).false = true;

If I understand, you are disabling the script component from GameObject, and it is trying to reenable from itself. You cant’t enable a disabled script inside itself. You need another script to enable it.

what about calling a “Start” function on your component ?
also you shoud keep a reference on your component instead of calling GetComponent all the time

Ideally you should only have one script for stopping and starting (at least if there isn’t lots of extra lines of code alongside the scripts). I don’t entirely know what the cause of the problem is, but just in case it could just be a simple a fix as that it the input isn’t being checked every frame.

Try making one single script with the following:

function Update() {
	if(Input.GetButtonDown("Jump")) {
		GetComponent("Follow Camera part 2").enabled = false;
	if(Input.GetButtonDown("Fire1")) {
		GetComponent("Follow Camera part 2").enabled = true;

wow thanks guys my script is now working :slight_smile: thank you for all your hard work