playMaker

Author Topic: StringPopup Action Attribute  (Read 1156 times)

Rebooter

  • Playmaker Newbie
  • *
  • Posts: 21
StringPopup Action Attribute
« on: June 06, 2020, 10:56:47 AM »
I'd like to see an Action Attribute added to Playmaker custom actions to make it easy to display a popup list of strings (that can be gotten from various sources) for a string field.

Examples:

Specify list directly:
[StringPopup("Cat", "Dog")] public string animal;

Get list from an array variable in the FSM:
[StringPopup(ArrayVariable)] public string animal;

Get list from a method in a class.
First parameter is a class and second is name of a method that returns the strings:
[StringPopup(typeof(StringListGeneratorClass), "GetStringList")] public string itemName;

I tried to do this myself with Playmaker's ObjectPropertyDrawer and also CustomActionEditor. I find custom editor scripting difficult to begin with, and Playmaker's versions of these aren't the same as the Unity versions, so I can't figure out how to adapt code that works in Unity's inspector to work for Playmaker. The Playmaker events don't give a Rect or position to use to draw a custom control (such as a popup), and I'm lost with it.

So it would be nice to have this functionality built in.