Hi as the the title says i have that error, please if some one could healp me ill be very greatful.
the code:
if (GameObject<healthBar> = 0)
{
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 2);
}
Hi as the the title says i have that error, please if some one could healp me ill be very greatful.
the code:
if (GameObject<healthBar> = 0)
{
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 2);
}
GameObject, do you have a health bar component or is it a field?
yes
ill pas you the code now
public HealthBar healthBar;
and the game object:
These are just your own typing mistakes (typos). Don’t make typos. It only slows you down.
The complete error message contains everything you need to know to fix the error yourself.
The important parts of the error message are:
Always start with the FIRST error in the console window, as sometimes that error causes or compounds some or all of the subsequent errors. Often the error will be immediately prior to the indicated line, so make sure to check there as well.
All of that information is in the actual error message and you must pay attention to it. Learn how to identify it instantly so you don’t have to stop your progress and fiddle around with the forum.
Remember: NOBODY here memorizes error codes. That’s not a thing. The error code is absolutely the least useful part of the error. It serves no purpose at all. Forget the error code. Put it out of your mind.
This is complete nonsense code. Go back to where you got it from and type it correctly. It makes no sense whatsoever.
If I had to wildly guess, it appears you are trying to do THREE things in one line.
Break it apart, do ONE thing at a time.
So go understand those steps. They are essentially the smallest steps you can take. Take them one at a time, one per line.
I cannot tell them to you because you need to read it out of your project.
Thanks to all you that helped me, im so grateful.