Hello. I really don’t know what I am doing, so if some one could help me figure this script out, that would be great. I am trying to get the bullet to destroy the Enemy.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SceneController : MonoBehaviour {
public GameObject Enemy;
public GameObject Bullet;
void OnTriggerEnter(Collider Bullet) {
Destroy(Enemy);
}
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
OnTriggerEnter ();
}
}
There is some good help here, but really, you should do some tutorials, as you seem a little lost on what to do - which is perfectly normal… all of us were there once. There are a lot of great ones here: https://unity3d.com/learn/tutorials
This one here has a tonne of shooter concepts in it that you could use:
This is a space-ship shooter, but even this would help you understand more:
What I think is the problem is that you are calling OnTriggerEnter in this line - void OnTriggerEnter(Collider Bullet) { Destroy(Enemy); }what I think you could do is change OnTriggerEnter to OnCollisionEnter or OnCollisionStay which would probably fix it. Hopefully I helped!