Scriptable Object Enum

Im trying to use Scriptable objects for dynmic enum ex : (Fire, Ice, Wind)

[CreateAssetMenu(fileName = "New Attack Item", menuName = "Menu/Enum/Enum Attack Item")]
public class EnumAttackItem : ScriptableObject { }

I got an other scriptable object that list those objects :

public List<EnumAttackItem> EnumList;

How can i compare the scriptable object enum in code ???

Ex: I got a weapon with the attack type fire

How can i do :

if (MyWeaponAttack == FIRE)
      // Code

Just like a real enum :

public Enum(Fire, Ice, Wind)  AttackType

if (MyWeaponAttack  == AttackType.Fire)

I dont want to hard code string … i want the real type !

plz Help !!!

Well, you don’t seem to get the point of using ScriptableObjects as enums. They are just empty objects and you can compare them. In order to compare them you have to have two references which you are going to compare. If you specifically know in code that you’re going to have a “FIRE” value, you have to declare that in the script where you want to do the comparison and assign the FIRE asset to that variable. Something like that:

// assign your FIRE asset here
public EnumAttackItem FIRE;

// now you can do that comparison you have in your question:
if (MyWeaponAttack == FIRE)

However this does of course defies the point of having a “dynamic enum” value since your code demands that there is an instance FIRE. The main point of using ScriptableObjects as dynamic enum values is to completely decouple the code from the actual meaning of the value. The code shouldn’t even know what values you may create in your project. Of course this depends on what you’re actually trying to accomplish.

I highly recommend you watch the enum part of this brilliant Unite Talk (though if you have the time I can also recommend watching the whole talk).

The great thing about using ScriptableObjects as enum values is that you can add meta data or even functionality into the “enum value” itself. So you can tie in either behaviour or configuration data into the value itself so the code that is actually using your enum doesn’t need to know what value we’re talking about.

Your original code where you said if (MyWeaponAttack == FIRE) is just plain procedural thinking. If you want to use SOs like shown in the video you have to think more in OOP terms and take a more abstract approach to whatever you want to actually solve.

If you want only to do

if(MyWeaponAttack == FIRE)


you can set a name of object and do an if statement like this

if(( == “Fire”)


I don’t like much this solution but for your challenge it works