using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BulletEnemy : MonoBehaviour
{
float Speed = 10f;
public GameObject explosionFactory;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
Vector3 dir = Vector3.down;
transform.position += dir * Speed * Time.deltaTime;
}
private void OnCollisionEnter(Collision collision)
{
Destroy(collision.gameObject);
Destroy(this.gameObject);
GameObject explosion = Instantiate(explosionFactory);
explosion.transform.position = transform.position;
}
}
적이 날 쏘면 맞아야되는데 아예 안맞고 겹쳐져서 지나가버림
OnCollisionEnter가 안불리나본데 충돌이 꺼져있거나 트리거같은게 켜져있거나
황당한게 적이 쏜걸 적은 맞고 터짐
레이어 설정 잘못한거 아님?
Z 위치 확인 레이어 태그 확인
레이어문제였어요 고마어