Hey, I’m currently creating my first game in unity and wanted to know if something I wanted to do was possible. I’ll try and describe the exact situation with my code right now and what I want it to do in the future.
So, I have a enum in a script called FighterBase. It is outside the main class and is in the global section.
public enum PowerSet
{
None,
Genuine_Fighter,
Borrowed_Power,
Mixed_Fighter,
God,
Demon
}
That enum is attached to scriptable objects, defining them as one of those options. So an object called “PersonA” for example could have it listed as a Mixed_Fighter.
I have a second script called Fighter. This script is for calculating the stats for a ‘Fighter’. I want to have the stats calculated in slightly different ways depending on what the scriptable object has in the enum PowerSet.
So I’ve tried something like this
PowerSet powerSet;
public int Strength;
{
if (powerSet == PowerSet.Mixed_Fighter)
{
// calculating stats here
}
}
with different if statements for the other options. When I do try this though, it comes up with tons of errors and the if statement refuses to work.
I’ve tried several tutorials and none of them have worked. Is there no way to reference the enum on the scriptable object? I also don’t want to move the enum over to the Fighter script, since that would make me have to redo the entire scriptable object too and make the script much longer.