playMaker

Author Topic: System.Object (or true "var") FSM varaible type  (Read 4011 times)

ciabaros

  • Playmaker Newbie
  • *
  • Posts: 13
System.Object (or true "var") FSM varaible type
« on: April 19, 2013, 12:54:47 PM »
Currently, you cannot store arbitrary objects as FSM varaibles, only ones which stem from UnityEngine.Object and certain specific PlayMaker ones...

If you added a System.Object variable type, then we could store way more stuff. I believe that a pseudo type which would correspond to C#'s "var" would also do the trick (and more), and this true "var" would be preferrable, if it makes sense in your current implementation.

Functional Roadblock:
I'm aware that choosing sub-type here (as you currently provide with the FsmObject type) would be massive :), but this could in theory be solved by either:
  • Tweaking this type selector to filter-as-you-type (requiring 1 character before anything shows up), or;
  • Removing the type-functionality altogether if you just stick to this being the "catch-all" auxiliary true C#"var" feature, all the way through (type considerations must be handled at run-time by Actions that choose to use this loose "type").

Thanks!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: System.Object (or true "var") FSM varaible type
« Reply #1 on: May 02, 2013, 01:42:36 PM »
hi,

 I also found out that UnityEngine.Object classes do not get any garbage collection, you have to explicitly free resources with a unity call, which is something to be very aware of cause it can create memory leaks very quicly on mobiles and lead to crash very very difficult to debug.

bye,

 Jean

ciabaros

  • Playmaker Newbie
  • *
  • Posts: 13
Re: System.Object (or true "var") FSM varaible type
« Reply #2 on: August 26, 2014, 02:59:55 AM »
I noticed this hasn't received any attention, in this forum or in upcoming feature lists. Is there a reason why it would be troublesome to allow arbitrary objects to be recognized by actions? Or am I the only one who's pulling my hair out because this can't currently be done?  :)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: System.Object (or true "var") FSM varaible type
« Reply #3 on: September 12, 2014, 03:00:46 AM »
Hi,
 
the bigg issue here is a serialization, I think Unity 5 will provide better mechanism for serializing your own classes, and maybe PlayMaker will be able to provide access to thatt. It's been researched, I had a go at this as well and never found a good way out ( and intuitive for non coders... cause if you can code, this is a not a show stopper, you just compose and create custom actions for your class and done).

Bye,

 Jean

ciabaros

  • Playmaker Newbie
  • *
  • Posts: 13
Re: System.Object (or true "var") FSM varaible type
« Reply #4 on: September 17, 2014, 01:55:17 AM »
Of course a solution is always to create custom classes just to encapsulate what you want to pass around. This is obviously not elegant, and forces some annoying patterns; but I'm not here to "boo hoo" :) Obviously if at some point, this becomes feasible/practical to implement, it would be greatly helpful.

The thing that I find surprising is that it seems you implied PlayMaker requires serialization of all the objects that are passed around in FSMs.. does this mean that PlayMaker serializes objects in order to store them in FSM variables at runtime?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: System.Object (or true "var") FSM varaible type
« Reply #5 on: September 18, 2014, 09:32:41 AM »
Hi,

 every component dealing with data must serialize data that needs to persits. it's a must, otherwise you would loose everything everytime you close Unity...

Since PlayMaker has a very specific approach, it can't serialize the simple variables ( floats, ints, string), it's just not enough, it has to serialize its own complex classes because a int within PlayMaker is a lot more than just an int, it has a name, and options like bneing shown on the inspector, or flaged as synchronizable for network, and so this falls out of what Unity support by default, and her comes the trouble that you must serialize everything yourself at that point.

 Bye,

 Jean