当前位置:网站首页>Game pause
Game pause
2022-07-23 05:35:00 【Glunn】
Preface
Set the game pause in the game , I often think of Time.timeScale = 0; This method , however Time.timeScale Just pause some things ; If in update Function that continuously changes the position of an object , This position change seems not to be affected by the suspension .
Function realization
First of all, make a in the scene Button.
Next create a script
Script name optional
The content can be as follows
private bool IsgamePaused;
public Button button;
private void IsButtonPaused()
{
if (IsgamePaused)
{
IsgamePaused = false;
Time.timeScale = 1;
}
else
{
IsgamePaused = true;
Time.timeScale = 0;
}
}
void Start ()
button.onClick.AddListener(IsButtonPaused)
}
Then attach the script to the scene to Button
Exhibition
I originally wrote the function of camera roaming
If you want to learn to roam, you can find another blog of mine
https://blog.csdn.net/weixin_42746271/article/details/90205342
The effect is as follows 
边栏推荐
- Learned on October 17
- Print all the words in the string array -- the story of pointer and string
- Leetcode-415. string addition
- Pointers and functions
- Apple logout account revoke token
- Some topics such as ctfhub web information disclosure WP CSDN creation punch in
- Ctfshow VIP limited and free topics CSDN creative punch in
- Solve the master-slave replication problem of MySQL under CentOS
- leetcode-932.漂亮数组
- Code random notes_ Array_ 209 subarray with the smallest length
猜你喜欢

leetcode-309. 最佳买卖股票时机含冷冻期

C语言中的冒泡排序

C语言进阶数据类型详解

Detailed explanation of C language linked list & Implementation of two important linked lists

MRS +Apache Zeppelin,让数据分析更便捷

Unity3D使用VRTK配置场景环境

交换二进制位中的奇偶位

Leetcode - the best time to buy and sell stocks, including handling charges

Introduction to C language arrays, functions, operators, and keywords

大一暑假实习day5_2
随机推荐
代码随想录笔记_数组_59螺旋矩阵II
代码随想录笔记_链表_142环形链表II
大一暑假实习day5_3
Leetcode-172. zero after factorial
C语言基础 - 字符串/字符数组最易错考点
Leetcode-528. random selection by weight
Code random notes_ Array_ 977 square of ordered array
Code random notes_ Linked list_ 19 exchange nodes in the linked list in pairs
Unity创建FPS监视
Super detailed - how to understand the expression while (scanf ("%d", & Num)! = EOF) in C language?
My redis collation
Pointers and functions
Bubble sorting in C language
FMETP Steam v2 使用方法(一)
C language implementation of three chess
How to use C language to realize headless one-way acyclic list single list?
摄像机漫游
Idea usage guide
C语言进阶数据类型详解
Leetcode-415. string addition