Quantcast
Channel: Questions in topic: "error"
Viewing all articles
Browse latest Browse all 7934

Type or namespace not found: Slider

$
0
0
I've used two similar lines of code for two different scripts, but one works and the other doesn't. My slider is the one giving me the error code, but I don't see any differences from the other script. using UnityEngine; using System.Collections; public class EnemyHealth : MonoBehaviour { public int startingHealth; public int currentHealth; public Slider healthSlider; public AudioClip Hit; public AudioClip death; public GameObject Explosion; AudioSource enemyAudio; EnemyMove enemyMovement; bool isDead; void Awake() { enemyAudio = GetComponent(); enemyMovement = GetComponent(); currentHealth = startingHealth; } public void TakeDamageEnemy(int amount) { currentHealth -= amount; healthSlider.value = currentHealth; enemyAudio.clip = Hit; enemyAudio.Play(); if(currentHealth <= 0 && !isDead) { Death(); } } void Death() { isDead = true; enemyAudio.clip = death; Instantiate(Explosion, transform.position, transform.rotation); enemyAudio.Play(); enemyMovement.enabled = false; Destroy(gameObject); } }

Viewing all articles
Browse latest Browse all 7934

Trending Articles



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