playMaker

Author Topic: Making custom FsmObject types?  (Read 2007 times)

Grofit

  • Junior Playmaker
  • **
  • Posts: 73
    • View Profile
Making custom FsmObject types?
« on: March 29, 2013, 07:44:51 AM »
Is it possible, and if so is there any documentation around making your own FsmObject types?

As I want to be able to have a custom action which takes a custom class as an argument, but I cannot use the c# type as its an unsupported type. So I was ideally wanting to wrap it in some sort of Fsm compatible type.

To give a bit more context I am making an action which will build a complex model given a certain class. Like an equipment screen, so you would equip a new piece of armour and it would then regenerate the underlying model in the preview.

The architecture itself is broken down into a few c# projects (written purely in visual studio) which contain the underlying logical objects and have some tests etc around them to prove all the logic works as intended. Then there is the unity side which basically creates objects through composition which use these underlying logical object, and IDEALLY I would like to pass in one of these logical objects (or at least a wrapped object) to make the process a bit simpler.

The action itself would be something like EquipItem and take an FsmOwner object for the main player and something like EquipmentItem for the item to equip.

Hope that makes sense...

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14237
  • Official Playmaker Support
    • View Profile
Re: Making custom FsmObject types?
« Reply #1 on: May 14, 2013, 01:38:01 AM »
Hi,

 your class simply need to extend Unity.Object.

 WARNING: Unity.Object do not obey garbage collections, they only get cleaned up if you call manually Resources.UnloadUnusedAssets() else on mobile you might get to a memory crash eventually if you use a lot of these.

bye,

 Jean