I am trying to build an enemy in my game. In this process I usually try a lot of different stuff in one script only and when I am happy with the result I split it up in smaller scripts.
Lets say that I have put 3 different move patterns and 2 different attack patterns in this big script. Is there a way to easily select between these in the inspector? I was thinking somewhere in the line of radio buttons or a drop down menu that I could connect to if statements in the script.
You probably want an enum. So you do something like:
enum MovePattern {Simple = 0, Complex, Other}
public MovePattern movePattern;
So then you expose 3 options to your editor. Then if your main update you can switch them:
switch(movePattern)
{
case Simple:
runSimpleCode()
break;
case Complex:
runComplexCode()
break;
case Other:
runOtherCode()
break;
}
Thank you it worked 
Just needed to write the cases like this:
case MovePattern.Simple:
And also make the enum public.
Cheers. 
1 Like