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

How to fix Assets\EXPBAR.cs(7,9): error CS0246: The type or namespace name 'Slider' could not be found (are you missing a using directive or an assembly reference?)

$
0
0
i have problem with xp script it says : Assets\EXPBAR.cs(7,9): error CS0246: The type or namespace name 'Slider' could not be found (are you missing a using directive or an assembly reference?) HERE IS SCRIPT using System.Collections; using System.Collections.Generic; using UnityEngine; public class EXPBAR : MonoBehaviour { public Slider xpBar; //This list contains the experience required for each level //Change these values in the inspector public List expPerLevel; //Don't change these, they are for reading only public int currentLevel = 1; public int currentExp = 0; public int targetExp = 0; void Awake () { //Initializing with example experience amounts if (expPerLevel.Count == 0) { expPerLevel.Add (100); expPerLevel.Add (200); expPerLevel.Add (400); expPerLevel.Add (800); } targetExp = expPerLevel[currentLevel - 1]; } //Call this from another script to add experience public void AddExperience (int amount) { currentExp += amount; //Check if we have leveled up if(currentExp >= targetExp){ currentExp -= targetExp; currentLevel++; Debug.Log("Leveled Up! Now you are level " + currentLevel); if(currentLevel <= expPerLevel.Count) targetExp = expPerLevel[currentLevel-1]; } //Show experience amount on the slider experienceBar.maxValue = targetExp; experienceBar.value = currentExp / targetExp; } }

Viewing all articles
Browse latest Browse all 2891

Trending Articles



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