質問編集履歴

4

スクリプトの修正

2021/10/17 11:33

投稿

mikichom_1229
mikichom_1229

スコア5

test CHANGED
File without changes
test CHANGED
@@ -220,14 +220,12 @@
220
220
 
221
221
  {
222
222
 
223
+        DaimahouUI.SetActive(false);
224
+
223
225
  if (!Daimahoubool)
224
226
 
225
227
  {
226
228
 
227
-
228
-
229
- DaimahouUI.SetActive(false);
230
-
231
229
  Daimahoubool = true;
232
230
 
233
231
 

3

スクリプトの修正

2021/10/17 11:33

投稿

mikichom_1229
mikichom_1229

スコア5

test CHANGED
File without changes
test CHANGED
@@ -207,3 +207,43 @@
207
207
  }
208
208
 
209
209
  ```
210
+
211
+ また、スクリプトを以下のように変更すると非アクティブ化はするのですが点滅しながら非アクティブになってしまいます。
212
+
213
+ ```C#
214
+
215
+ void Update()
216
+
217
+ {
218
+
219
+ if (DaimahouGage.fillAmount == 1)
220
+
221
+ {
222
+
223
+ if (!Daimahoubool)
224
+
225
+ {
226
+
227
+
228
+
229
+ DaimahouUI.SetActive(false);
230
+
231
+ Daimahoubool = true;
232
+
233
+
234
+
235
+ Book.GetComponent<bookaction>().enabled = false;
236
+
237
+ director.Play();
238
+
239
+ Touroku.SetActive(true);
240
+
241
+ MovieBook.SetActive(true);
242
+
243
+ }
244
+
245
+ }
246
+
247
+ }
248
+
249
+ ```

2

スクリプトの修正

2021/10/17 11:32

投稿

mikichom_1229
mikichom_1229

スコア5

test CHANGED
File without changes
test CHANGED
@@ -103,3 +103,107 @@
103
103
  }
104
104
 
105
105
  ```
106
+
107
+
108
+
109
+ スクリプトを以下のように修正しました。
110
+
111
+ 実行は一度だけになったのですが、DaimahouUIが非アクティブになってくれません。
112
+
113
+ ImageがDaimahouUIの中にあるからでしょうか?
114
+
115
+ この場合どうすればよいのか教えていただきたいです。
116
+
117
+ ```C#
118
+
119
+ using System.Collections;
120
+
121
+ using System.Collections.Generic;
122
+
123
+ using UnityEngine;
124
+
125
+ using UnityEngine.Playables;
126
+
127
+ using UnityEngine.UI;
128
+
129
+
130
+
131
+ public class DaimahouScript : MonoBehaviour
132
+
133
+ {
134
+
135
+ private bool Daimahoubool = false;
136
+
137
+
138
+
139
+ public PlayableDirector director;
140
+
141
+ public Image DaimahouGage;
142
+
143
+
144
+
145
+ public GameObject DaimahouUI;
146
+
147
+
148
+
149
+ public GameObject Book;
150
+
151
+
152
+
153
+ public GameObject MovieBook;
154
+
155
+ public GameObject Touroku;
156
+
157
+
158
+
159
+ // Start is called before the first frame update
160
+
161
+ void Start()
162
+
163
+ {
164
+
165
+ DaimahouGage = DaimahouGage.GetComponent<Image>();
166
+
167
+ }
168
+
169
+
170
+
171
+ // Update is called once per frame
172
+
173
+ void Update()
174
+
175
+ {
176
+
177
+ if (DaimahouGage.fillAmount == 1)
178
+
179
+ {
180
+
181
+ if (!Daimahoubool)
182
+
183
+ {
184
+
185
+ Daimahoubool = true;
186
+
187
+
188
+
189
+ Book.GetComponent<bookaction>().enabled = false;
190
+
191
+ director.Play();
192
+
193
+ Touroku.SetActive(true);
194
+
195
+ MovieBook.SetActive(true);
196
+
197
+ DaimahouUI.SetActive(false);
198
+
199
+ }
200
+
201
+ }
202
+
203
+ }
204
+
205
+
206
+
207
+ }
208
+
209
+ ```

1

タイトルの修正

2021/10/17 11:12

投稿

mikichom_1229
mikichom_1229

スコア5

test CHANGED
@@ -1 +1 @@
1
- 何度も実行してしまうものを一度だけ実行したい
1
+ C# 何度も実行してしまうものを一度だけ実行したい
test CHANGED
File without changes