- Home /
How to fix this error
I am trying my hand at a 2d sidescroller game and am trying to implement a health system. I was making my player's health return after death and this error came up.
Assets/Scripts/LevelManager.cs(58,41): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
line 58 in my LevelManager script is....healthManager.FullHealth;
Can anyone please help so I can continue, Thanks!
Answer by DiegoSLTS · Mar 02, 2015 at 12:35 PM
If "FullHealth" is a property you have to assign it's value to another variable (and the "get" will be called) or assign a value to it ("set" will be called). Just writing "healthManager.FullHealth" doesn't mean anything.
Answer by AlwaysSunny · Mar 02, 2015 at 07:16 AM
It looks like you meant to invoke a method.
healthManager.FullHealth();
This implies that, on whatever type of object healthManager is, there is a method like this:
void FullHealth() {
// set health to full here
}
Your answer
Follow this Question
Related Questions
Double Jump 1 Answer
Can anyone just read this over? for my 2d runner? 1 Answer
GameObject.FindGameObjectWithTag not finding the tagged objects. 1 Answer
Better 2D Sprite Jump in 3D Plane 1 Answer
How to Inverse a line 0 Answers