Create inspector drop-down button based on the content of a list in editor mode

Hi!


Here is my problem:

  1. I have a ScriptableObject class called Discovery, that has a class variable, GeneticCode

  2. GeneticCode isn’t Monobehaviour, and i want it to be serialized in the inspector window of its Discovery, but it looks like i can’t use CustomEditor, CustomPropertyDrawer seems to be more approriate

  3. GeneticCode has a list of Gene. Gene is another ScriptableObject class that i want to be able to drag and drop in the GeneticCode list to create a formula. They can be random except for the first one, that we can call BaseGene.

  4. I want the BaseGene to be only settable to a specific list of Gene. This BaseGene list has to be settable somewhere in the inspector and when i come back to set the formula of a GeneticCode, the BaseGene appears like a drop-down menu based on the content of the BaseGene list, just like an enum would.


Any ideas on how to properly achieve this?
Thanks!
PS: In the screenshot, the BaseGene is just the first element of the list but it will be separated from the others.


109078-dropdownmenu.jpg


109079-dropdownmenu2.jpg


Yes, use a custom property drawer and EditorGUILayout.Popup.