UnityNinja Community
Would you like to react to this message? Create an account in a few clicks or log in to continue.

UnityNinja CommunityLog in

UnityNinja - Video Game Development Community, including Resources, Forums, Marketplace & More.


descriptionHelp creating a pause menu[Script Available] EmptyHelp 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;
       }  
}

descriptionHelp creating a pause menu[Script Available] EmptyRe: 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
privacy_tip Permissions in this forum:
You cannot reply to topics in this forum
power_settings_newLogin to reply