這是一個盾牌的prefab

其作用就是摧毀地方的子彈,可以實作效果。
在我將它實體化后,生成在我的父物體面前后摧毀地方子彈的效果就消失了,3s后自毀效果仍然在。

using System.Collections;這是盾牌原始碼,想請教一下原因以及解決方法。
using System.Collections.Generic;
using UnityEngine;
public class Defence : MonoBehaviour
{
// Start is called before the first frame update
public float Right_last = 3f;
public GameObject D_VA;
void Start()
{
}
// Update is called once per frame
void Update()
{
Right_last -= Time.deltaTime;
if (Right_last <= 0)
{
Destroy(this.gameObject);
}
}
private void OnTriggerEnter(Collider other)
{
if (other.gameObject.CompareTag("enemybullet")) Destroy(other.gameObject);
}
}
uj5u.com熱心網友回復:
24 號到現在。沒人回答。。。表示我沒看明白,你到底要實作啥功能!遇到什么問題!
請重新縷一縷你要的需求!
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/39274.html
標籤:Unity3D
