playMaker

Author Topic: How to reference/connect a scriptable object to an FSM variable?  (Read 1420 times)

ChrisFishFern

  • Playmaker Newbie
  • *
  • Posts: 5
Hi Everyone,

Apologies is this is a complete beginner question; I've been looking around to try and solve my problem, but can't seem to find a solution anywhere. Basically, in the same way that listing 'public FsmString stringVar' exposes a variable in the action properties that lets me connect it with an FSMvariable, I'm looking for a way to do the same except one that lets me expose a variable to take a scriptable object (the scriptable object type 'Item').

I get that I could use 'public Item itemVar' to expose it, however I need to be able to connect this input in the action with an FSM global variable. At this stage I have successfully set up a global variable of the 'Object' type, which then uses 'Item' as its type, however I can't seem to work out how to do the same in the code for my custom action.

Apologies if this is poorly explained, I feel like there is probably a way to do this, but I'm still quite new to PlayMaker/Unity/C#, so I'm not great at explaining myself.

Thanks in advance for any help anyone can give! :)

mech_alina

  • Playmaker Newbie
  • *
  • Posts: 8
Re: How to reference/connect a scriptable object to an FSM variable?
« Reply #1 on: July 21, 2022, 05:37:52 PM »
I'm not sure if you figured this out yet. But you can create a Variable Type definition for playmaker to be able to start using your scriptable object in the FSMs.

Right click your project folder > Playmaker > Create New Variable Definition