Calling and changing the same instance with different scripts (Unity)

Hi All

Is it possible to control an instance with one script that was created with a different script?
For example, I want to pause music that was created when the FPS controller started, by pausing from my game manager script for a pause menu.

This is common question when using Unity. Declare your FPS controller script in your Game Manager script at the start of the class like this:

private FPSControllerScript fpsController;

Replace FPSControllerScript with the right name of your FPS controller script. Save the script and drag your GameObject containing the FPS controller into the new empty field appearing in the Game Manager component.

After that you can easily access the EventInstance in your Game Manager by calling this code for example:


Replace EventInstance with your instance’s name and make sure the instance is set to public in the FPS controller script.