- Home /
Cant assign global variable to method parameter variable
When i assign it doesnt make any action Why?
Public bool hungerstat_active;
Void test(bool activation)
{
if(activation==hungerstat_active)
{
stat.Healthstat++;
}
}
Could you provide more code? You're making changes to things that aren't defined in your example, and there is too little to find a problem in your code.
The problem is even if “if” statement return to true the method inside if statement is not working.Healthstat variable is same as its default value.
I'll need more code to deter$$anonymous$$e the issue, then. From what I see, there's no reason it wouldn't work.
Answer by theLameBrain · Apr 08, 2021 at 09:17 PM
First thing I would do is add
Debug.Log(hungerstat_active + ", " + activation);
before you do the actual if statement, just to be sure that those values are the same. next add another debug line inside the If statement, just to be sure that it is not activating and you cannot tell for some other reason.
As VoidVenom mentioned, there isn't a lot of code here to go on.