Trouble Calling a Function from Another Script

Hey all, I’m getting the following;

error CS0246: The type or namespace name `Pause’ could not be found. Are you missing an assembly reference?

In reference to this line in one of my scripts;

PauseGame pausegame = GetComponent<Pause>();

I’m attempting to grab the following function from another of my scripts named PauseGame.cs

public void Pause()

I’ve checked a few forums and some similar questions which resolved some other issues with this piece of code I had, but now I can’t seem to figure out what to do. New to Unity so I don’t understand 100% of the concepts but I can’t see what I’m doing wrong. Any help is much appreciated.

GetComponent().Pause();
Your component will be the name of your script and from your script you can access your method.

private PauseGame pg;

void Start() {
pg = GameObject.FindWithTag("GameManager").GetComponent<PauseGame>();
 }

pg.Pause();

This should work perfectly then.
It’s a good idea to do this in the start function, and keep it as a reference, so you don’t have to call it every single time (its not good performance)