Like topic headline: When running the game and my projectile hits the enemy i get the error:
MissingComponentException: There is no ‘Collider’ attached to the “Lazer1(Clone)” game object, but a script is trying to access it.
You probably need to add a Collider to the game object “Lazer1(Clone)”. Or your script needs to check if the component is attached before using it.
EnemyBehaviour.OnTriggerEnter2D (UnityEngine.Collider2D mincol) (at Assets/Enteties/Enemy/EnemyBehaviour.cs:12)
But the lazer1 does have a box collider 2d attached to it.
This is the code on the enemyBehaviour script:
void OnTriggerEnter2D(Collider2D mincol) {
Projectile misil = mincol.GetComponent<Collider>().gameObject.GetComponent<Projectile>();
if (misil)
{ //if misil existerar, inte är null eller false
Debug.Log("treffad av misil");
