using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GOLD : MonoBehaviour
{void Start()
{}
void Update()
{}
void OnCollisionEnter2D(Collision2D coll)
{
if (coll.gameObject.tag == "gold")
{
Destroy(this.gameObject);
}
}
}
void OnCollisionEnter2D(Collision2D coll)
>>>就是當兩個Collider碰撞,Destroy(this.gameObject);
>>>金幣物件會消失。要是沒成功的話,一樣要記得檢查Tag的地方設定是否正確,不然可能無法呈現成功喔~~~!!