FragMate CommunityLog in

FragMate - Software and Game Developer Community, including Resources, Forums, Marketplace & More.

Share

descriptionHelp creating a pause menu[Script Available]

more_horiz
Hello guys I have this problem with this pause menu script where I just want to put buttons simply just put a menu button and retry button. And if possible disable mouse look. Thanks really appreciate ur help guys!!


Code:

var paused : boolean = false;

function Update () {

 if(Input.GetKeyDown("p") && paused == false) {  
 paused = true;  
 Time.timeScale = 0;
        }
        else if(Input.GetKeyDown("p") && paused == true) {
                paused = false;
                Time.timeScale = 1;
       }  
}

descriptionRe: Help creating a pause menu[Script Available]

more_horiz
GetComponent<MouseLook>().enabled = true;
GetComponent<MouseLook>().enabled = false;

Wink

Code:


using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using UnityStandardAssets.CrossPlatformInput;
using UnityStandardAssets.Utility;
using Random = UnityEngine.Random;
using UnityStandardAssets.Characters.FirstPerson;
...
public GameObject player;
...
void Update (){
...
player.GetComponent<FirstPersonController>().GetComponent<MouseLook>().enabled = !player.GetComponent<FirstPersonController>().GetComponent<MouseLook>().enabled;
...
}


Otherwise watch this

http://answers.unity3d.com/questions/555710/script-to-disable-mouselook.html
Permissions in this forum:
You cannot reply to topics in this forum