質問編集履歴
1
追加Script
title
CHANGED
File without changes
|
body
CHANGED
@@ -5,9 +5,31 @@
|
|
5
5
|
呼び出そうとしているScript(Bボタン)に複数Scriptがついているのですが、これも原因の一つでしょうか。
|
6
6
|
何卒ご教示のほどよろしくお願いいたします。
|
7
7
|
|
8
|
+
AボタンについているScriptです。
|
8
9
|
```C#
|
10
|
+
using System.Collections;
|
11
|
+
using System.Collections.Generic;
|
12
|
+
using UnityEngine;
|
13
|
+
|
14
|
+
public class AButtonInvoke : MonoBehaviour
|
15
|
+
{
|
16
|
+
// オブジェクト指定
|
17
|
+
public GameObject AButtonControl;
|
18
|
+
|
19
|
+
public GameObject MainObject;
|
20
|
+
|
21
|
+
public GameObject AButton;
|
22
|
+
|
23
|
+
public GameObject BButton;
|
24
|
+
|
25
|
+
|
26
|
+
// ボタンをクリックした時の処理
|
27
|
+
public void OnClick()
|
28
|
+
{
|
29
|
+
StartCoroutine("AbuttonPush");
|
30
|
+
}
|
9
31
|
// 現れる時間指定
|
10
|
-
IEnumerator
|
32
|
+
IEnumerator AbuttonPush()
|
11
33
|
{
|
12
34
|
// 現れる時間
|
13
35
|
yield return new WaitForSeconds(13f);
|
@@ -16,5 +38,85 @@
|
|
16
38
|
{
|
17
39
|
Debug.Log("停止した");
|
18
40
|
}
|
41
|
+
yield return new WaitForSeconds(13f);
|
42
|
+
MainObject.gameObject.SetActive(true);
|
19
43
|
```
|
44
|
+
|
45
|
+
|
20
|
-
|
46
|
+
Bボタンに付けているScriptです。
|
47
|
+
```C#
|
48
|
+
using System.Collections;
|
49
|
+
using System.Collections.Generic;
|
50
|
+
using UnityEngine;
|
51
|
+
using UnityEngine.UI;
|
52
|
+
|
53
|
+
public class BButtonControl : MonoBehaviour
|
54
|
+
{
|
55
|
+
|
56
|
+
// ボタンをクリックした時の処理
|
57
|
+
public void OnClick()
|
58
|
+
{
|
59
|
+
// ボタンを非表示にする
|
60
|
+
gameObject.SetActive(false);
|
61
|
+
TransparentCanvas.SetActive("MainObject", true);
|
62
|
+
|
63
|
+
// ボタンを表示する
|
64
|
+
TransparentCanvas.SetActive("AButton", true);
|
65
|
+
}
|
66
|
+
}
|
67
|
+
``````
|
68
|
+
InterruptionScriptです。
|
69
|
+
``````
|
70
|
+
C#
|
71
|
+
using System.Collections;
|
72
|
+
using System.Collections.Generic;
|
73
|
+
using UnityEngine;
|
74
|
+
using UnityEngine.UI;
|
75
|
+
|
76
|
+
|
77
|
+
public class Interruption : MonoBehaviour
|
78
|
+
{
|
79
|
+
|
80
|
+
// オブジェクト指定
|
81
|
+
public GameObject AButtonControl;
|
82
|
+
|
83
|
+
public GameObject MainObject;
|
84
|
+
|
85
|
+
public GameObject AButton;
|
86
|
+
|
87
|
+
public GameObject BButton;
|
88
|
+
|
89
|
+
// オブジェクト非表示
|
90
|
+
void Start()
|
91
|
+
{
|
92
|
+
|
93
|
+
MainObject.gameObject.SetActive(false);
|
94
|
+
|
95
|
+
}
|
96
|
+
// ボタンをクリックした時の処理
|
97
|
+
public void OnClick()
|
98
|
+
{
|
99
|
+
paused = true;
|
100
|
+
StartCoroutine("startPush");
|
101
|
+
gameObject.SetActive(false);
|
102
|
+
}
|
103
|
+
|
104
|
+
// 現れる時間指定
|
105
|
+
IEnumerator startPush()
|
106
|
+
{
|
107
|
+
yield return new WaitForSeconds(1f);
|
108
|
+
MainMenu_Scene.gameObject.SetActive(true);
|
109
|
+
// Objectを表示する
|
110
|
+
IEnumerator startPush()
|
111
|
+
{
|
112
|
+
yield return new WaitForSeconds(1f);
|
113
|
+
MainObject.gameObject.SetActive(true);
|
114
|
+
|
115
|
+
yield return new WaitForSeconds(1f);
|
116
|
+
TransparentCanvas.SetActive("AButton", true);
|
117
|
+
|
118
|
+
|
119
|
+
}
|
120
|
+
}
|
121
|
+
```
|
122
|
+
上記が付けている物になります。
|