Unity Ninja Unity 3D Forum
To have exclusive access to all downloads, recourses and links within this forum, a free registered account is required. Just a heads up Wink
Share
Go down
avatar
Member [Lv. 1]
Member [Lv. 1]
Posts : 2
Points : 751
Rep : 0
Join date : 2016-07-02
View user profile

Help creating a pause menu[Script Available]

on Tue Jul 19, 2016 9:04 am
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;
       }  
}
avatar
{SUPER MEMBER}-LV.4
{SUPER MEMBER}-LV.4
Posts : 53
Points : 1527
Rep : 11
Join date : 2015-01-18
Age : 41
Location : Italia
View user profile

Re: Help creating a pause menu[Script Available]

on Wed Jul 27, 2016 2:00 pm
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
Back to top
Permissions in this forum:
You cannot reply to topics in this forum