###前提・実現したいこと
objectの削除したい
###該当のソースコード
C#
1using System.Collections; 2using System.Collections.Generic; 3using UnityEngine; 4 5public class ShopColider : MonoBehaviour 6{ 7 8 public static Vector3 nowPos; 9 public GameObject sign_board; 10 11 void OnTriggerEnter(Collider collision) 12 { 13 if (signManager.sign_boardFlag == false) 14 { 15 nowPos = transform.position; 16 17 Vector3 pos = new Vector3(nowPos.x, nowPos.y + 40, nowPos.z); 18 19 Instantiate(sign_board, pos, Quaternion.identity, transform.parent); 20 signManager.sign_boardFlag = true; 21 22 } 23 } 24 //オブジェクトが離れた時 25 void OnTriggerExit(Collider collision) 26 { 27 if (signManager.sign_boardFlag == true) 28 { 29 if (sign_board != null) 30 { 31 GameObject obj = Instantiate(sign_board) as GameObject; 32 GameObject.Destroy(obj); 33 } 34 signManager.sign_boardFlag = false; 35 } 36 } 37} 38
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。