teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

4

スクリプトの修正

2021/10/17 11:33

投稿

mikichom_1229
mikichom_1229

スコア5

title CHANGED
File without changes
body CHANGED
@@ -109,10 +109,9 @@
109
109
  {
110
110
  if (DaimahouGage.fillAmount == 1)
111
111
  {
112
+        DaimahouUI.SetActive(false);
112
113
  if (!Daimahoubool)
113
114
  {
114
-
115
- DaimahouUI.SetActive(false);
116
115
  Daimahoubool = true;
117
116
 
118
117
  Book.GetComponent<bookaction>().enabled = false;

3

スクリプトの修正

2021/10/17 11:33

投稿

mikichom_1229
mikichom_1229

スコア5

title CHANGED
File without changes
body CHANGED
@@ -102,4 +102,24 @@
102
102
  }
103
103
 
104
104
  }
105
+ ```
106
+ また、スクリプトを以下のように変更すると非アクティブ化はするのですが点滅しながら非アクティブになってしまいます。
107
+ ```C#
108
+ void Update()
109
+ {
110
+ if (DaimahouGage.fillAmount == 1)
111
+ {
112
+ if (!Daimahoubool)
113
+ {
114
+
115
+ DaimahouUI.SetActive(false);
116
+ Daimahoubool = true;
117
+
118
+ Book.GetComponent<bookaction>().enabled = false;
119
+ director.Play();
120
+ Touroku.SetActive(true);
121
+ MovieBook.SetActive(true);
122
+ }
123
+ }
124
+ }
105
125
  ```

2

スクリプトの修正

2021/10/17 11:32

投稿

mikichom_1229
mikichom_1229

スコア5

title CHANGED
File without changes
body CHANGED
@@ -50,4 +50,56 @@
50
50
  }
51
51
 
52
52
  }
53
+ ```
54
+
55
+ スクリプトを以下のように修正しました。
56
+ 実行は一度だけになったのですが、DaimahouUIが非アクティブになってくれません。
57
+ ImageがDaimahouUIの中にあるからでしょうか?
58
+ この場合どうすればよいのか教えていただきたいです。
59
+ ```C#
60
+ using System.Collections;
61
+ using System.Collections.Generic;
62
+ using UnityEngine;
63
+ using UnityEngine.Playables;
64
+ using UnityEngine.UI;
65
+
66
+ public class DaimahouScript : MonoBehaviour
67
+ {
68
+ private bool Daimahoubool = false;
69
+
70
+ public PlayableDirector director;
71
+ public Image DaimahouGage;
72
+
73
+ public GameObject DaimahouUI;
74
+
75
+ public GameObject Book;
76
+
77
+ public GameObject MovieBook;
78
+ public GameObject Touroku;
79
+
80
+ // Start is called before the first frame update
81
+ void Start()
82
+ {
83
+ DaimahouGage = DaimahouGage.GetComponent<Image>();
84
+ }
85
+
86
+ // Update is called once per frame
87
+ void Update()
88
+ {
89
+ if (DaimahouGage.fillAmount == 1)
90
+ {
91
+ if (!Daimahoubool)
92
+ {
93
+ Daimahoubool = true;
94
+
95
+ Book.GetComponent<bookaction>().enabled = false;
96
+ director.Play();
97
+ Touroku.SetActive(true);
98
+ MovieBook.SetActive(true);
99
+ DaimahouUI.SetActive(false);
100
+ }
101
+ }
102
+ }
103
+
104
+ }
53
105
  ```

1

タイトルの修正

2021/10/17 11:12

投稿

mikichom_1229
mikichom_1229

スコア5

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