質問編集履歴

6

追記

2016/09/30 16:12

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -193,77 +193,3 @@
193
193
  }
194
194
 
195
195
  ```
196
-
197
-
198
-
199
- ###追記②
200
-
201
- ご回答ありがとうございます。追記しました。
202
-
203
- ```C#
204
-
205
- GameObject pObject;
206
-
207
- ParticleSystem particle;
208
-
209
-
210
-
211
- //ここでパーティクルが停止される時間を指定
212
-
213
- float particleDelayTime = .01f;
214
-
215
-
216
-
217
- void Awake()
218
-
219
- {
220
-
221
- pObject = GameObject.FindGameObjectWithTag ("ParticleSystem");
222
-
223
- particle = pObject.GetComponent<ParticleSystem> ();
224
-
225
- particle.gameObject.SetActive(false);
226
-
227
- }
228
-
229
-
230
-
231
- void Update()
232
-
233
- {
234
-
235
- if (Input.GetKey(KeyCode.F) && particle.isStopped) {
236
-
237
- particle.gameObject.SetActive (true);
238
-
239
- particle.Simulate (4.0f, true, true);
240
-
241
- particle.Play ();
242
-
243
- StartCoroutine (delay (particleDelayTime, () => {
244
-
245
- particle.gameObject.SetActive (false);
246
-
247
- }));
248
-
249
- //for Debug
250
-
251
- Debug.Log ("A");
252
-
253
- }
254
-
255
- }
256
-
257
-
258
-
259
- IEnumerator delay(float waitTime, UnityAction action)
260
-
261
- {
262
-
263
- yield return new WaitForSeconds(waitTime);
264
-
265
- action();
266
-
267
- }
268
-
269
- ```

5

追記

2016/09/30 16:12

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -197,3 +197,73 @@
197
197
 
198
198
 
199
199
  ###追記②
200
+
201
+ ご回答ありがとうございます。追記しました。
202
+
203
+ ```C#
204
+
205
+ GameObject pObject;
206
+
207
+ ParticleSystem particle;
208
+
209
+
210
+
211
+ //ここでパーティクルが停止される時間を指定
212
+
213
+ float particleDelayTime = .01f;
214
+
215
+
216
+
217
+ void Awake()
218
+
219
+ {
220
+
221
+ pObject = GameObject.FindGameObjectWithTag ("ParticleSystem");
222
+
223
+ particle = pObject.GetComponent<ParticleSystem> ();
224
+
225
+ particle.gameObject.SetActive(false);
226
+
227
+ }
228
+
229
+
230
+
231
+ void Update()
232
+
233
+ {
234
+
235
+ if (Input.GetKey(KeyCode.F) && particle.isStopped) {
236
+
237
+ particle.gameObject.SetActive (true);
238
+
239
+ particle.Simulate (4.0f, true, true);
240
+
241
+ particle.Play ();
242
+
243
+ StartCoroutine (delay (particleDelayTime, () => {
244
+
245
+ particle.gameObject.SetActive (false);
246
+
247
+ }));
248
+
249
+ //for Debug
250
+
251
+ Debug.Log ("A");
252
+
253
+ }
254
+
255
+ }
256
+
257
+
258
+
259
+ IEnumerator delay(float waitTime, UnityAction action)
260
+
261
+ {
262
+
263
+ yield return new WaitForSeconds(waitTime);
264
+
265
+ action();
266
+
267
+ }
268
+
269
+ ```

4

更新

2016/09/29 15:33

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -197,39 +197,3 @@
197
197
 
198
198
 
199
199
  ###追記②
200
-
201
- ご回答ありがとうございます。
202
-
203
-
204
-
205
- ![イメージ説明](c8d47a601223b14adf844714186f6dac.png)
206
-
207
- ```C#
208
-
209
- GameObject pObject;
210
-
211
- ParticleSystem particle;
212
-
213
-
214
-
215
- //ここでパーティクルが停止される時間を指定
216
-
217
- float particleDelayTime = .2f;
218
-
219
-
220
-
221
- void Awake()
222
-
223
- {
224
-
225
- pObject = GameObject.FindGameObjectWithTag("ParticleSystem")
226
-
227
- particle = pObject.GetComponent<ParticleSystem> (); //←24行目
228
-
229
- particle.gameObject.SetActive(false);
230
-
231
- }
232
-
233
- ```
234
-
235
- > Assets/GameObjectScript.cs(24,24): error CS1525: Unexpected symbol `particle'

3

追記

2016/09/29 15:28

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -128,7 +128,7 @@
128
128
 
129
129
 
130
130
 
131
- ###追記
131
+ ###追記
132
132
 
133
133
  ご回答ありがとうございます。追記しました。
134
134
 
@@ -193,3 +193,43 @@
193
193
  }
194
194
 
195
195
  ```
196
+
197
+
198
+
199
+ ###追記②
200
+
201
+ ご回答ありがとうございます。
202
+
203
+
204
+
205
+ ![イメージ説明](c8d47a601223b14adf844714186f6dac.png)
206
+
207
+ ```C#
208
+
209
+ GameObject pObject;
210
+
211
+ ParticleSystem particle;
212
+
213
+
214
+
215
+ //ここでパーティクルが停止される時間を指定
216
+
217
+ float particleDelayTime = .2f;
218
+
219
+
220
+
221
+ void Awake()
222
+
223
+ {
224
+
225
+ pObject = GameObject.FindGameObjectWithTag("ParticleSystem")
226
+
227
+ particle = pObject.GetComponent<ParticleSystem> (); //←24行目
228
+
229
+ particle.gameObject.SetActive(false);
230
+
231
+ }
232
+
233
+ ```
234
+
235
+ > Assets/GameObjectScript.cs(24,24): error CS1525: Unexpected symbol `particle'

2

追記

2016/09/29 15:19

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -130,7 +130,7 @@
130
130
 
131
131
  ###追記
132
132
 
133
-
133
+ ご回答ありがとうございます。追記しました。
134
134
 
135
135
  ```C#
136
136
 

1

追記

2016/09/28 09:38

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  仕様:
8
8
 
9
- Fキーを押した瞬間だけ、パーティクルを表示する。それ以外の時はパーティクルは非表示。
9
+ Fキーを押した瞬間だけ、指定した再生位置でパーティクルを表示する。それ以外の時はパーティクルは非表示。
10
10
 
11
11
 
12
12
 
@@ -125,3 +125,71 @@
125
125
 
126
126
 
127
127
  ご教授のほどよろしくお願いします。
128
+
129
+
130
+
131
+ ###追記
132
+
133
+
134
+
135
+ ```C#
136
+
137
+ //ここでパーティクルが停止される時間を指定
138
+
139
+ float particleDelayTime = .2f;
140
+
141
+
142
+
143
+ void Awake()
144
+
145
+ {
146
+
147
+ pObject = GameObject.Find ("Particle System");
148
+
149
+ particle = pObject.GetComponent<ParticleSystem> ();
150
+
151
+ particle.gameObject.SetActive(false);
152
+
153
+ }
154
+
155
+
156
+
157
+ void Update()
158
+
159
+ {
160
+
161
+ if (Input.GetKeyDown ("f") && particle.isStopped) {
162
+
163
+ particle.gameObject.SetActive (true);
164
+
165
+ particle.Simulate (4.0f, true, true); //追記。
166
+
167
+ particle.Play (); //追記。
168
+
169
+ StartCoroutine (delay (particleDelayTime, () => {
170
+
171
+ particle.gameObject.SetActive (false);
172
+
173
+ }));
174
+
175
+ //for Debug
176
+
177
+ Debug.Log ("A");
178
+
179
+ }
180
+
181
+ }
182
+
183
+
184
+
185
+ IEnumerator delay(float waitTime, UnityAction action)
186
+
187
+ {
188
+
189
+ yield return new WaitForSeconds(waitTime);
190
+
191
+ action();
192
+
193
+ }
194
+
195
+ ```