I have started using basic physics within unity by applying an ontrigger function to my GameObjects. This is simply done through the inspector panel by adding a rigid body and for this project I have turned off gravity.
the “is Trigger” is turned to true so the GameObjects can be recognised when using the “OnTriggerEnter” Method. Now I would like to make the laser destroy the enemy and itself on collision. I have used an If statement and applied tags to these GameObjects through the inspector panel.
So on collision if the game object named Laser collides with Enemy it is destroyed along with itself. I also added another IF statement to destroy the enemy if it collides with it. Here is the result: