Unityの教科書にていがぐりを的にぶつけたときにパーティクルを生成する、または当たった瞬間に消滅するところまではできたのですがこれらを同時に行うことができません。
自分なりに調べてやってみてはいたのですがなかなかうまくいきません、どなたかアドバイスをお願いします。
C#
1using System.Collections; 2using System.Collections.Generic; 3using UnityEngine; 4 5public class targetController : MonoBehaviour { 6 public GameObject ParticlePrefab; 7 // Use this for initialization 8 void Start () { 9 10 } 11 12 // Update is called once per frame 13 void Update () { 14 15 } 16 17 void OnTriggerEnter(Collider other) 18 { 19 if (other.gameObject.tag == "igaguri") 20 { 21 GameObject particle = Instantiate(ParticlePrefab) as GameObject; 22 Vector3 hitpos = other.ClosestPointOnBounds(this.transform.position); 23 particle.transform.position = hitpos; 24 } 25 Destroy(other.gameObject); 26 27
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/12/17 11:11