Lets say I have an enum
public enum Colors {
Black,
White,
Red
};
public Colors Brush;
Then I have ScriptableObject with colors variables defined:
public class ColorsLib: ScriptableObject
{
public Color Black = new Color32(0,0,0,1);
public Color White= new Color32(255,255,255,1);
public Color Red = new Color32(255,0,0,1);
}
The question is: am I able to use enum values as a names of scriptable obj without creating dictionary, like this:
public Color Palette;
Palette = ColorsLib.Brush[1]; //I know this is incorrect syntaxes but the idea is I want to grab ScriptableObj variable by name taken from enum... But Brush[1] is White (isnt just a string right?) and I want grab this White from my ColorsLib somehow
So I can create an additional dictionary when I ll write something like “Black” = ColorsLib.Black; and then use enum Brush[1].ToString() to grab the value from dictionary but I would like to avoid this