Quantcast
Channel: Questions in topic: "tagging"
Viewing all articles
Browse latest Browse all 120

Can not detect Tag

$
0
0
I have also tried making a samll overlap area around the 2D collider but that didn't work out here is the script` using UnityEngine; using System.Collections; public class hELT : MonoBehaviour { public int currentHealth = 5; public int maxHealth = 5; void Start() { } void Update() { if (currentHealth > maxHealth) { currentHealth = maxHealth; } if (currentHealth <= 0) { currentHealth = 0; Die(); } } void Die() { Destroy(gameObject); } void TakeDamage(int damage) { currentHealth -= damage; } void OnColliderEnter(Collider other) { if (other.tag == "Enemy") { TakeDamage(5); } } } `

Viewing all articles
Browse latest Browse all 120

Trending Articles



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