質問編集履歴
2
誤字
test
CHANGED
File without changes
|
test
CHANGED
@@ -22,6 +22,62 @@
|
|
22
22
|
MenuUI_Open関数の「Time.timeScale」がプロジェクト全体を止めてしまっているようで、メニュー画面の操作も止めてしまう。
|
23
23
|
|
24
24
|

|
25
|
+
|
26
|
+
**ソースコート**
|
27
|
+
|
28
|
+
■GameSystemクラス
|
29
|
+
|
30
|
+
```C#
|
31
|
+
using System.Collections;
|
32
|
+
using System.Collections.Generic;
|
33
|
+
using UnityEngine;
|
34
|
+
using UnityEngine.UI;
|
35
|
+
using UnityEngine.InputSystem;
|
36
|
+
|
37
|
+
public class GameSystem : MonoBehaviour
|
38
|
+
{
|
39
|
+
|
40
|
+
public UIController uiController; //UIControllerクラス
|
41
|
+
|
42
|
+
void OnMenu(InputValue inputValue)
|
43
|
+
{
|
44
|
+
uiController.MenuUI_Open()
|
45
|
+
}
|
46
|
+
}
|
47
|
+
```
|
48
|
+
|
49
|
+
■UIControllerクラス
|
50
|
+
|
51
|
+
```C#
|
52
|
+
using System.Collections;
|
53
|
+
using System.Collections.Generic;
|
54
|
+
using UnityEngine.EventSystems;
|
55
|
+
using UnityEngine;
|
56
|
+
using UnityEngine.UI;
|
57
|
+
using UnityEngine.InputSystem;
|
58
|
+
|
59
|
+
public class UIController : MonoBehaviour
|
60
|
+
{
|
61
|
+
|
62
|
+
public Button primarybutton; //最初に選択されるボタン
|
63
|
+
public GameObject MenuUI; //メニュー画面
|
64
|
+
|
65
|
+
public void MenuUI_Open() //メニュー画面コントロール
|
66
|
+
{
|
67
|
+
MenuUI.SetActive(!MenuUI.activeSelf);
|
68
|
+
if (MenuUI.activeSelf == true)
|
69
|
+
{
|
70
|
+
Time.timeScale = 0;
|
71
|
+
primarybutton.Select();
|
72
|
+
}
|
73
|
+
else
|
74
|
+
{
|
75
|
+
Time.timeScale = 1;
|
76
|
+
}
|
77
|
+
}
|
78
|
+
}
|
79
|
+
|
80
|
+
```
|
25
81
|
|
26
82
|
情報不足でしたら申し訳ございません。
|
27
83
|
お手数をおかけしますが、正しい使い方をご教示いただけると幸いです。
|
1
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Unityでメニュー画面(UI)を起動した際に、ゲームを一時停止したい
|
1
|
+
Unityでメニュー画面(UI)を起動した際に、ゲームを一時停止したい
|
test
CHANGED
File without changes
|