【发布时间】:2018-05-29 15:29:34
【问题描述】:
我制作了一个 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..
}
}
}
有什么想法吗?我一直在寻找几个小时..
【问题讨论】:
-
当您按下按钮时,您是否在控制台选项卡中看到 "Entered Pause Func"?
-
@Programmer 是的
标签: c# user-interface unity3d