playMaker

Author Topic: PlayMaker extension: new variable type  (Read 1913 times)

focus

  • Playmaker Newbie
  • *
  • Posts: 4
    • View Profile
PlayMaker extension: new variable type
« on: November 05, 2014, 07:51:00 PM »
Hey guys!
Is it possible to extend PlayMaker and add few more variables types?
Maybe using reflection?..

focus

  • Playmaker Newbie
  • *
  • Posts: 4
    • View Profile
Re: PlayMaker extension: new variable type
« Reply #1 on: November 06, 2014, 05:52:34 PM »
Anyone?  :-\
I'd glad to hear anything on this topic, even if there are no any good news.

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2488
  • Yup.
    • View Profile
    • Cleverous
Re: PlayMaker extension: new variable type
« Reply #2 on: November 06, 2014, 06:10:20 PM »
It depends on what you need to do?

Sometimes you can basically just put your code encapsulated in an action and trigger it through the interface, that lets you at least work with variables that are native in your project if you're using something unusual or custom. Through the use of other custom actions and a proxy object you could probably make something work. Arraymaker does this, essentially.

On the other hand if you mean that you want to use MyFancyVarType in the Variables tab alongside Int, Float, Etc.. then I'm not sure, you'll have to wait for Alex's response on that one I think.

There is a bit of custom editor stuff on the wiki, but doesn't sound like what you're looking for.

focus

  • Playmaker Newbie
  • *
  • Posts: 4
    • View Profile
Re: PlayMaker extension: new variable type
« Reply #3 on: November 06, 2014, 06:22:31 PM »
Thanks for your quick reply, Lane!
Yeah, I'm about adding new vars to the Variables tab in first place.

I have a bit customized types-replacers for basic types from my plugin. Like ObscuredInt. It actually implicitly converts to and from the int. Thus it usually able to replace usual int without any additional work from the user - they just change the int type to the ObscuredInt and all continues to work as usual (from the user sight, but there are some stuff happening under the hood to protect int variable from memory search).

I'd like to add ObscuredInt, etc. to the Variables to let Playmaker users make use of secure variables for money, etc. in their games.

I know it is possible to make proxy class, but it would be much more comfortable for user to just select ObscuredInt instead of Int.

That's why I'm looking for any possible way to do that, including any dirty hacks with reflection %)

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2488
  • Yup.
    • View Profile
    • Cleverous
Re: PlayMaker extension: new variable type
« Reply #4 on: November 06, 2014, 06:40:06 PM »
I see.. Yeah I don't have the answer on that one, unfortunately. If the other guys don't chime in after a while just bump the thread, I'll ping them if it gets buried.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14121
  • Official Playmaker Support
    • View Profile
Re: PlayMaker extension: new variable type
« Reply #5 on: November 06, 2014, 10:55:52 PM »
Hi,

The only way I know of is to use FsmObject and wrap your variable in a Unity object.

Warning! Unity object are not subject to garbage collection you have to manually call Unity to clean up, and that's VERY costly, and you can end up with memory leak very quickly.

 I use this trick here and there but definitly not something to underestimate. Serialization will also be an issue, but with Unity 5 I hope it's going to be better.

 Bye,

 Jean

focus

  • Playmaker Newbie
  • *
  • Posts: 4
    • View Profile
Re: PlayMaker extension: new variable type
« Reply #6 on: November 07, 2014, 03:46:39 AM »
Thanks, Jean. This is something I was afraid of  :(
Hope PlayMaker will have some flexible way to extend its variables collection in future, it could be really useful for many developers.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14121
  • Official Playmaker Support
    • View Profile
Re: PlayMaker extension: new variable type
« Reply #7 on: November 14, 2014, 12:17:54 PM »
Hi,

 yes, I would like this very much too. I would also very much like events to become classes we can extend and so on.

 Bye,

 Jean