unity陨石不能正常爆炸
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DestroyByContact : MonoBehaviour {
public GameObject explosion;//星星爆炸特效
public GameObject playerExplosion;//飞船爆炸特效
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnTriggerEnter(Collider other)
{
if (other.tag == "Boundary" || other.tag == "EnemBolt") return;
return;
Instantiate(explosion, transform.position, transform.rotation);
if (other.tag == "Player")
Instantiate(playerExplosion, other.transform.position, other.transform.rotation);
Destroy(other.gameObject);
Destroy(gameObject);
}
}
陨石不会被子弹打爆
多了一个return,删除一个就行了