Tank Shooting Mechanic in Unity 2d - Tank game tutorial P4 - panicarts.com

Tank Shooting Mechanic in Unity 2d – Tank game tutorial P4

Sunny Valley Studio
Views: 4885
Like: 91
In this Unity tutorial we will implement Basic Tank Shooting mechanic. We will spawn a bullet that will inflict damage on collision. We will also prevent self collision – bullet colliding with the tank that shoots it. This is part of the 2D Top Down Tank game tutorial series. Playlist

00:00 Introduction
00:59 Recap
01:45 Fixing Turret Rotation modifier
03:19 Barrel Game Object
04:04 Creating A Bullet
05:54 Bullet Script
08:41 Bullet Collision Detection
09:51 Shooting the Bullet
13:49 Ignoring Collision with Self
14:16 Testing the shooting
15:15 Getting Hit Script
18:04 Bullet Damaging target
19:16 OnDeath event
20:14 Mentioning Scriptable Objects
21:04 Support me?

Scripts and UnityPackages:
Full project:

Would you like to learn how to make a 2d shooter in Unity?

You can support me through Patreon:

Assets used:

Join the discord:


  1. Right after shooting the game stops saying " NullReferenceException: Object reference not set to an instance of an object Turret.shoot() " What should I do?

  2. i dont know if you still reply to comments but on 18:38 im using OnCollisionEnter2D instead of OnTriggerEnter2D and im getting the error: 'Collision2D' does not contain a definition for 'GetComponent' and no accessible extension method 'GetComponent' accepting a first argument of type 'Collision2D' could be found (are you missing a using directive or an assembly reference?). do you know how i can fix it?

  3. honestly I love the amount of tutorial videos you have i can learn so much from your videos keep up the good work

Leave a Reply

Your email address will not be published.