Error in a really short script

when using this it says: Assets/Scripts/pause atm.js(1,5): UCE0001: ‘;’ expected. Insert a semicolon at the end. also this works on mobile too right?

bool isPaused;

void Start ()
{
  isPaused = false;
}
 
void OnGUI ()
{ 
  if (!isPaused)
  {
    if (GUI.Button(Rect(10,10,50,50), "Pause"))
    {
      Time.timeScale = 0f;
      isPaused = true;
    }
  }
  if (isPaused)
  {
    if (GUI.Button(Rect(10,10,50,50), "Play"))
    {
      Time.timeScale = 1.0f;
      isPaused = false;
    }
  }
}

This is only the part of the code that answer the question, but you can’t create a c# file and paste just that. Even more so if it’s a js file. Have a look at how c# script is done. Basically, you need a class inheriting from monobehaviour, put your methods inside, and have the “using UnityEngine” at the top of the file, outside the class.

you are mixing C# and javascript, in c# it looks like this:

using UnityEngine;
using System.Collections;

public class PoolLib : MonoBehaviour {
	bool isPaused;
 
	void Start (){
	isPaused = false;
	}
	 
	void OnGUI (){ 
		if (!isPaused){
			if (GUI.Button(new Rect(10,10,50,50), "Pause")){
				Time.timeScale = 0f;
				isPaused = true;
			}
		}
		if (isPaused){
			if (GUI.Button(new Rect(10,10,50,50), "Play")){
				Time.timeScale = 1.0f;
				isPaused = false;
			}
		}
	}
}