playMaker

Author Topic: [SOLVED] Adding action member types  (Read 3300 times)

Guillaume Portes

  • Playmaker Newbie
  • *
  • Posts: 4
[SOLVED] Adding action member types
« on: October 09, 2012, 11:53:51 AM »
Hello,

I'm new to PlayMaker so apologies if this is either stupid or has been answered some other obvious place, but I haven't come across the solution.
I'm writing a custom action which would ideally expose a variable of a custom type, as follows:

[Serializable]
public class MyCustomParameter
{
    string a;
    string b;
    string c;
    int i;
    float f;
}

namespace HutongGames.PlayMaker.Actions
{
    public class MyAction : FsmStateAction
    {
         public MyCustomParameter[] MCP;
         ...
    }
}

That doesn't work - i.e. MCP doesn't come up in the action inspector -, throwing "Unsupported Type: MyCustomParameter" in the actions browser, and "ActionData: Missing LoadActionField for type: MyCustomParameter".

I really want to do things this way as I want to be able to fill MCP with variables that are retrieved by other states of the FSM.

Am I missing something, or is it only possible to use a certain set of types as Action members?

Thanks!

Guillaume.
« Last Edit: October 11, 2012, 04:04:07 AM by Guillaume Portes »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Adding action member types
« Reply #1 on: October 10, 2012, 01:51:47 AM »
Bonjour Guillaume :)

Unfortunatly, Playmaker Actions do have limitations in that area.

 I would hide away the MyCustomParameter by exposing each properties normally, using one variable per property, and then within the OnEnter, you get all the details from the action interface and create your MyCustomParameter and inject in each properties what the user choose

If you need a working example let me know.

bye,

 Jean

Guillaume Portes

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Adding action member types
« Reply #2 on: October 10, 2012, 04:19:36 AM »
Merci Jean :)

Do you know if there is an actual stumbling block, or is it "just" something that could be implemented later on?
I ended up doing roughly what you suggested, which of course works, but is not too convenient when wanting to deal with arrays.

For instance, instead of having an action that can call MyArrayFunction(MyCustomParameter[] p) I have to call MyFunction(MyCustomParameter) "n" times.

Thanks!

G.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Adding action member types
« Reply #3 on: October 11, 2012, 03:41:42 AM »
Hi,

I do not know when and if action UI will become more flexible, so I would stick with alternatives for now. I don^t think it's difficult to open, but I Think it would lead to a less solid system because we would start doing crazy things... I think it's more about keeping consistency then anything else, which is a very good point actually, only constraining for advanced use.

 Have you checked ArrayMaker? this might help you achieve more of what you want.

https://hutonggames.fogbugz.com/default.asp?W715

bye,

 Jean

Guillaume Portes

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Adding action member types
« Reply #4 on: October 11, 2012, 04:03:48 AM »
I did take a look at arrayMaker indeed, but only to see if it was adding its own "action member types", which it doesn't (as you know ;) ).
I'll look at it again to see if it can give me a better solution than the one I have at the moment.

Thanks again for the answers Jean, very helpful!

G.