Question by
zereda-games · Feb 22, 2019 at 04:43 AM ·
c#c# tutorial
How to do an if statment for a variable not an if statement in a method like #if UNITY_EDITOR as example?
I would like to know if you can use a Static or Constant in some way to to make you own
"#"if UNITY_EDITOR
"#"endif
and how to do it.
does something kinda like this work?
static bool MyStaticBool=false;
"#"if (MyStaticBool)
const string MyString="String A: You Won";
"#"elseif
const string MyString="String B: You Failed";
"#"endif
public static void ChangeBool(bool enable){
MyStaticBool=enable;
}
or
const bool MyConstantBool=false;
"#"if (Equals(MyStaticBool, MyConstantBool))
const string MyString="String A: You Won";
"#"elseif
const string MyString="String B: You Failed";
"#"endif
not that this is what i want to do exactly per say, i'm just trying to make a clear example of what i'm trying to do.
Comment
I bring this to attention because i'm curious if I can have an
"*If(IsConnected){
PlayerInfoData is = to get property's
} else{
PlayerInfoData is = to blank variable's
}*"
In Order to always have a cleared Database of sorts.