- Home /
Adding a component in editor mode by selecting an Enum.
Hello the question is simple. I have an Enum with 3 kinds of items (options). I want that when the player selects an item from that list in the editor, the Script that contains the behavior of that selection is added automatically to the game object and the other items previously selected (added) get removed.
Thank you. Hope someone could help me with that.
Answer by Graham-Dunnett · Mar 31, 2015 at 09:58 AM
Create a window, iterate over your enum and add buttons to the window. When the user presses a button, look to see if a GO is selected, and add the script. I think the docs just about cover it. If you are struggling, just post the code you've written and ask for help.
Your answer
Follow this Question
Related Questions
Working with Unity Editor 1 Answer
Distribute terrain in zones 3 Answers
DrawDefaultInspector of another script in custom inspector 1 Answer
How to access Custom Inspector own gameObject 1 Answer
Microsoft Visual C# Compiler error 0 Answers