回答編集履歴
3
[
test
CHANGED
@@ -101,3 +101,7 @@
|
|
101
101
|
|
102
102
|
|
103
103
|
![イメージ説明](6b3e67949a9d5b45ff0d190dc44e2e88.png)
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
※設定後、ヒエラルキーのゲームオブジェクト(Particle System)は消して大丈夫です。
|
2
追記2
test
CHANGED
@@ -89,3 +89,15 @@
|
|
89
89
|
}
|
90
90
|
|
91
91
|
```
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
---
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
追記2:
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
![イメージ説明](6b3e67949a9d5b45ff0d190dc44e2e88.png)
|
1
追記
test
CHANGED
@@ -7,3 +7,85 @@
|
|
7
7
|
|
8
8
|
|
9
9
|
上記が設定されていない、あるいは設定が正しくないのだと思われます。
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
---
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
追記:
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
ParticleSystemをアタッチしたプレハブを用意しておき、そのプレハブからゲームオブジェクトを生成するというのはどうでしょうか。
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
```C#
|
26
|
+
|
27
|
+
using System.Collections;
|
28
|
+
|
29
|
+
using System.Collections.Generic;
|
30
|
+
|
31
|
+
using UnityEngine;
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
public class BulletController : MonoBehaviour
|
36
|
+
|
37
|
+
{
|
38
|
+
|
39
|
+
public GameObject m_particleSystem; // ParticleSystemをアタッチしているプレハブを設定
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
// Use this for initialization
|
44
|
+
|
45
|
+
void Start ()
|
46
|
+
|
47
|
+
{
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
}
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
void Update()
|
56
|
+
|
57
|
+
{
|
58
|
+
|
59
|
+
transform.Translate(0, 0.2f, 0);
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
if (transform.position.y > 5)
|
64
|
+
|
65
|
+
{
|
66
|
+
|
67
|
+
Destroy(gameObject);
|
68
|
+
|
69
|
+
}
|
70
|
+
|
71
|
+
}
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
void OnTriggerEnter2D(Collider2D coll)
|
76
|
+
|
77
|
+
{
|
78
|
+
|
79
|
+
GameObject obj = Instantiate(m_particleSystem, transform.position, Quaternion.identity);
|
80
|
+
|
81
|
+
obj.GetComponent<ParticleSystem>().Play();
|
82
|
+
|
83
|
+
Destroy(coll.gameObject);
|
84
|
+
|
85
|
+
Destroy(gameObject);
|
86
|
+
|
87
|
+
}
|
88
|
+
|
89
|
+
}
|
90
|
+
|
91
|
+
```
|