- Home /
i keep getting error code CS0103
Hi, i am new to Unity so sorry if this is an obvious question but i keep getting this error message: Assets/Healthbar.cs(17,17): error CS0103: The name `addjustcurHealth' does not exist in the current context I have tried to fix it but more errors keep popping up this is the script:
using UnityEngine; using System.Collections;
public class Healthbar : MonoBehaviour { public int maxHealth = 100; public int curHealth = 100;
public float healthBarLength;
//Use this for inialization
void start () {
healthBarLength = Screen.width / 2;
}
//Update is called once per frame
void update () {
addjustcurHealth(0);
}
void OnGUI() {
GUI.Box(new Rect( 10, 10, healthBarLength, 20),curHealth + "/" + maxHealth);
}
public void AddjustCurrentHealth(int adj) {
curHealth += adj;
healthBarLength = (Screen.width / 2) * (curHealth / (float)maxHealth);
}
}
i am using it in an rpg if this makes and difference and have connected it to the first person controller. Thanks
Answer by aldonaletto · Jun 18, 2012 at 01:43 PM
Unity is right: addjustcurHealth does not exist in this script - do you mean AddjustCurrentHealth? Case matters in Unity, and the names are different anyway - by the way, the same applies to update and start: they should be Update and Start
Your answer
Follow this Question
Related Questions
CS0103 error when building scenes 0 Answers
My C# script give me an error? 1 Answer
Opinion on this level upgrading system? 0 Answers
Health Bar problem 1 Answer
How to Find Child Of A Child.? C# 1 Answer