Create a gist now

Instantly share code, notes, and snippets.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// お金オブジェクト、プレイヤーに触れたら消える。
public class MoneyObj : MonoBehaviour {
int mMoneyValue = 100;
public GameObject mParent;
void OnTriggerEnter2D(Collider2D col)
{
if (col.gameObject.tag == "Player")
{
// 親を消す
Destroy(mParent);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment