- Home /
Question by
AmbitiousSerif · Jun 18, 2013 at 04:46 AM ·
c#error message
what does it mean when something does not exist in the current context mean
I am getting the error message of adjustcurrenthealth does not exist in this instance here is the code if needed
using System.Collections;
public class health : MonoBehaviour {
public GUIStyle PlayercurhealthplaceH;
public GUIStyle Playercurhealthtext;
public int MaxHealth = 320;
public int CurHealth = 320;
public float HealthBarLength;
void start(){
HealthBarLength = 200;
}
void OnGUI(){
GUI.Box(new Rect((Screen.width /2) -339,(Screen.height /2) +300,200,20),"", PlayercurhealthplaceH);
GUI.Box(new Rect((Screen.width /2) -339,(Screen.height /2) +300,200/(MaxHealth/CurHealth),20), CurHealth + "/" + MaxHealth, Playercurhealthtext);
}
public void AdjustCurrentHealth(int Adj){
CurHealth += Adj;
if (CurHealth <0)
CurHealth = 0;
if(CurHealth > MaxHealth)
CurHealth = MaxHealth;
if(MaxHealth < 1)
MaxHealth = 1;
HealthBarLength = (200) * (CurHealth/(float)MaxHealth);
}
public void update() {
adjustcurrenthealth(0);
}
}
Comment
Answer by robertbu · Jun 18, 2013 at 04:47 AM
C# (and Javascript) is case sensitive. So your call on line 48 to 'adjustcurrenthealth()', is not the same as the function 'AdjustCurrentHealth()' on line 28.
x) missed that one since it's indented in a strange way. In short the OP should work on his program$$anonymous$$g style / discipline.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
How to handle inactive object updates 0 Answers
Error opening project.,Error opening project 0 Answers
i have some code for Faux Gravity that doesn't work as intended. 0 Answers