Space Shooter Tutorial - Explosions not appearing when objects are destroyed.
I had everything working fine but all of a sudden my explosions stopped working when my spaceship/astroids/bolts collide. When objects collide they are destroyed as intended. I can't figure out what is wrong with the code. I have the explosion mapped to the explosion box within the Inspection panel. The following code is from my DestroyByContacts script which is attached to my asteroids.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DestroyByContact : MonoBehaviour {
public GameObject explosion;
void OnTriggerEnter(Collider other)
{
if (other.tag == "Boundary")
{
return;
}
Instantiate(explosion, transform.position, transform.rotation);
Destroy(other.gameObject);
Destroy(gameObject);
}
}
I have this exact same problem. What version of Unity are you running? I'm on 2017.2.0b9
Your answer
Follow this Question
Related Questions
Space shooter tutorial, space ship keep moving and has interia 1 Answer
My shots don't want to move! 1 Answer
Space Shooter lighting problem? 0 Answers
[tutorial - Space Shooter] about smoothing in EvasiveManeuver.cs 2 Answers
My bolt isn't respawning in game Its driving me crazy i have been at it for 2 days !! 1 Answer