- Home /
Editor window BuildTarget as enum
Hello everyone.
I'm trying to make an editor window that creates scene asset bundles for me.
I want to give the option to chose what is the build target using EditorGUI.EnumPopup.
But I can't seem to use BuildTarget as enum....
I tried doing something like:
private BuildTarget buildTarget;
(the following code is inside OnGUI)
buildTarget = EditorGUI.EnumPopup("Build Target", buildTarget);
But I'm getting a "cant convert BuildTarget to enum" kind of error.
I'm not sure what to do because BuildTarget is an enum...
Any ideas? (without me creating my own enum)
Thanks!
Answer by dorpeleg · Sep 16, 2013 at 10:55 AM
Solved it.
BuildTarget is an enum, I just wasn't using the EditorGUI.EnumPopup correctly.
Here is the correct way:
buildTarget = (BuildTarget)EditorGUI.EnumPopup("Build Target", buildTarget);
Answer by TonyLi · Aug 13, 2013 at 02:08 PM
I believe BuildTarget is a static class, not an enum.
When I type it in, I get the hint thingy and it says " enum BuildTarget".
But if it is a static class (maybe with an enum in there)
How can I easly get all of the possible build targets?