Disabling My Scripts

Hey…So for my pause menu I want to disable some of my players scripts so they can’t move but for some reason I keep getting this error message.

CS0176: Static member ‘UnityEngine.GameObject.Find(string)’ cannot be accessed with an instance reference, qualify it with a type name instead.

Now I’m sure that this is a stupid question and is very obvious but I am newer and experienced with scripting. I’m not sure what It means by this and how to fix it. Help would be much appreciated.

Thanks :slight_smile:

Here’s my coding if you need it:

    using UnityEngine;
    using System.Collections;
    
    public class pauseMenu : MonoBehaviour {
    
    	public GUISkin myskin;
    
    	private Rect windowRect;
    	private bool paused = false, waited = true;
    	
    	private void Start(){
    		windowRect= new Rect(Screen.width /2 - 100, Screen.height /2 -100, 200, 200);
    	}
    
    	private void waiting(){
    		waited = true;
    	}
    
    	private void Update(){
    		if(waited)
    		if(Input.GetKey(KeyCode.Escape) || Input.GetKey(KeyCode.P)){
    			if(paused == true)
    				paused = false;
    			else
    				paused = true;	
    
    			waited = false;
    			Invoke("waiting",0.3f);
    		}
    		if (paused == true) {
    			//makes cursor appear
    			Cursor.visible = true;
          		//locks vertical and horizontal axis for the camera
<!--ERROR--!>    			gameObject.Find("PlayerController").GetComponent(PlayerMovement).enabled = false;
    			//Need to turn off player movement
<!--ERROR--!>    			gameObject.Find("PlayerController").GetComponent(CharacterController).enabled = false;
    			//Need to turn off player shooting
<!--ERROR--!>    			gameObject.Find("PlayerController").GetComponent(PlayerShooting).enabled = false;
    		}
    	}
    
    	private void OnGUI(){
    		if (paused)
    			windowRect = GUI.Window(0, windowRect, windowFunc, "Pause Menu");
    	}
    
    	private void windowFunc(int id){
    		//Exits Pause
    		if(GUILayout.Button("Resume")){
    			paused = false;
    		}
    		//Options for game
    		if(GUILayout.Button("Options")){
    			
    		}
    		//Quits the game
    		if(GUILayout.Button("Exit Game")){
    			Application.Quit();
    		}
    	}
    }

Try

GameObject.Find(...)

Uppercase G