Can Someone please provide me with the correct direction to Enable and Disable the Unity FPSController Script when going to a pause menu: My Current situation is i made a script put in on my FPS controller using the Following info:
Using UnityStandardAssets.Characters.FirstPerson;
public class PauseMenu: MonoBehaviour
{
public GameObject MainMenu; // MainMenuCanvas
void update()
{
if(Input.GetKeyDown(KeyCode.Escape))
{
MainMenu.setActive(true); // main menu active
GetComponent().enabled = false;
}
}
}
Once I apply this script Above im able to pull up the main menu canvas properly and the FPS controller that moves the player no longer moves which is Good. My issue: On My MainMenu Canvas I made buttons EX: Resume Game Exit Game etc:
I added to my main menu script under the button press function for resume game
GetComponent().enabled = true;
For some reason it does not re-enabled the FPSController script. Hope i dont confuse you all on this part. As a test on my Pausemeu script
i added an Else if with the following code Below. And This works but i dont want to have the player hit C to re-enable the FPS controller i want them to hit the Resume Button on my Canavs Menu to have it do that. Any Suggestions
{
if(Input.GetKeyDown(KeyCode.C))
{
GetComponent().enabled = true;
{