Instantiate()してしまうと毎回生成されるため好ましくありません。自分は一回だけ生成してそれ以降そのパーティクルを再生して消して再生しての繰り返しを行いたいです。
using System.Collections; using System.Collections.Generic; using UnityEngine; public class Tree_Mng : MonoBehaviour { int HP = 3; bool HitDamage = false; GameObject wp_obj; Weapon wp; public GameObject ps;//ヒットエフェクト // Start is called before the first frame update void Start() { // wp_obj = GameObject.Find("B_R_Hand"); wp_obj = GameObject.Find("Weapon_obj"); wp = wp_obj.GetComponent<Weapon>(); } // Update is called once per frame void Update() { } private void OnTriggerEnter(Collider other) { if(other.tag == "Player_Weapon") { Instantiate(ps,wp.transform.position,transform.rotation); Debug.Log("ヒット エフェクト"); } } }
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2020/01/15 06:34