Quantcast
Channel: Questions in topic: "enemy"
Viewing all articles
Browse latest Browse all 1488

Unity 2D Enemy Problem

$
0
0
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

Viewing all articles
Browse latest Browse all 1488

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>