Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: focus on November 05, 2014, 09:51:00 PM

Title: PlayMaker extension: new variable type
Post by: focus on November 05, 2014, 09:51:00 PM
Hey guys!
Is it possible to extend PlayMaker and add few more variables types?
Maybe using reflection?..
Title: Re: PlayMaker extension: new variable type
Post by: focus on November 06, 2014, 07:52:34 PM
Anyone?  :-\
I'd glad to hear anything on this topic, even if there are no any good news.
Title: Re: PlayMaker extension: new variable type
Post by: Lane on November 06, 2014, 08: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.
Title: Re: PlayMaker extension: new variable type
Post by: focus on November 06, 2014, 08: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 %)
Title: Re: PlayMaker extension: new variable type
Post by: Lane on November 06, 2014, 08: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.
Title: Re: PlayMaker extension: new variable type
Post by: jeanfabre on November 07, 2014, 12:55:52 AM
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
Title: Re: PlayMaker extension: new variable type
Post by: focus on November 07, 2014, 05: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.
Title: Re: PlayMaker extension: new variable type
Post by: jeanfabre on November 14, 2014, 02: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
Title: Re: PlayMaker extension: new variable type
Post by: Yulian on July 02, 2021, 01:08:47 PM
Dear PlayMaker devs,

PlayMaker already have variable like FsmEnum which represent custom Enums.
Please consider to add new types like FsmClass and FsmStruct to represent custom Classes and Structures. This will make PlayMaker more robust and developer-friendly.

I have given this idea to you for free. ;)

Regards,
Yulian