Unity 2D Enemy Problem
I am trying to create an endless runner where i have ghost-like enemies, which die from bullets, but the player can go through them if they are not dead. The problem is, I can't make it so the player can go through the enemy. I have tried making a script and attacking it to the enemy, but it does not work and the enemy stops the player. Here is the script: using System.Collections; using System.Collections.Generic; using UnityEngine;
public class EnemyController : MonoBehaviour { public GameObject Enemy; void OnTriggerEnter2D(Collider2D other) { if(other.gameObject.name == "Player") { Enemy.SetActive(false); } } }
Any help
Never $$anonymous$$d I got it
But how would I add a system where I get points if a shoot but not when i hit the ghost?
Your answer
Follow this Question
Related Questions
How to make an enemy 2d chasing player? 2 Answers
how to make knockback and slowmotion when hit by enemy 0 Answers
Need help with player interact animation with obstacles in a endless runner like zombie tsunami 0 Answers
how to make an enemy into a second player 0 Answers
How can I do an Enemy while He's walking his HEAD always see the Target? 1 Answer