When I have developed this section of code it was working well - player ship got killed after a few hits.
But after I moved to the next lesson (Controlling collisions with layers) it just stopped working. The laser beams just move through the ship and terminate on the Shredder (so I guess projectile is working well and the ship is the cause of problem).
I have rechecked all inspector settings and they are ok, also layer collisions are set ok ({enemy laser - friend} and {frinedlaser - enemy})
In debugging i found out that collision happens - OnTriggerEnter2D is executed (prints a console line), but something goes wrong in the next sentence - the IF clause is NOT executed because the [missile == null] (this prints in console)
Projectile missile = collider.gameObject.GetComponent();
//print(missile);
I have copied the line from the EnemyBehaviour.cs where it is working (just in case as it was the same before) and it still does not work. The Projectile.cs code is just the same for the enemy and it works there fine.
This is driving me crazy - everything is identical as for the enemy, but it does not work. Again: it stopped working after working on the layers lesson, so I guess that is where the bug is hiding, but i just have no clue why. Any help or idea is appreciated.