- Home /
fftWindow isn't enum C#?
Hi, FFTWindow is enum if I'm making simple code:
public FFTWindow jia;
But when I'm writing script to modify other scripts variables in incpector:
myTarget.Jia = (MyStuff.Jia)EditorGUILayout.EnumPopup ("Something", myTarget.Jia);
Console is saying: Cannot implicitly convert type System.Enum' to
UnityEngine.FFTWindow'. An explicit conversion exists (are you missing a cast?) But if I make that code to enum which I made it's working. So my question is: how to make it? How to add FFTWindow with EditorGuiLayout?
Answer by Bunny83 · Sep 12, 2015 at 10:37 AM
What is "MyStuff.Jia"? Since you declared your variable of type "FFTWindow" you have to cast the return value to FFTWindow:
myTarget.Jia = (FFTWindow)EditorGUILayout.EnumPopup ("Something", myTarget.Jia);
It's working, thanks. I just started using EditorGuiLayout and that's was first problem i couldn't solve.
Your answer
Follow this Question
Related Questions
problems writing an enum range attribute 1 Answer
Display TM symbol in enum on GUI 1 Answer
Type cast to a enum? 1 Answer
EnumPopup an enum from another class 1 Answer
EditorGUI Enum help 1 Answer