我制作了一个 unity3d 游戏,我想添加 UI 。我从暂停按钮开始,但它似乎不起作用。这是按钮信息:
我已经创建了一个 uiManager 脚本来管理按钮,如上图所示,代码如下:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class myUIManager : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
public void Pause() //Function to take care of Pause Button..
{
print("Entered Pause Func");
if (Time.timeScale == 1 && paused == false) //1 means the time is normal so the game is running..
{
print("Enterer first if");
Time.timeScale = 0; //Pause Game..
}
if (Time.timeScale == 0)
{
Time.timeScale = 1; //Resume Game..
}
}
}
这是画布屏幕截图:
有任何想法吗?我一直在寻找几个小时..
牧羊人nacy
青春有我
相关分类