Unity and Playmaker

Now that I have an agent that I can move around the map, the next step is to get it moving between a resource point and a drop-off point. I can program that behaviour myself (I won’t comment on the quality of my solution but I know I can do it), but one of the reasons to use Unity is its plugin ecosystem so I wanted to see what options were available for creating a Finite State Machine.


I bought a Humble Bundle last year with a load of Unity plugins and one of them was Playmaker, a visual scripting tool. Looking at the Unity Asset Store showed me that NodeCanvas is a popular option, but since I already owned Playmaker I figured I’d start there. The creators of Hollow Knight use Playmaker so that was good enough for me.

Using Playmaker I was able to have an agent move to a resource field, collect resources over time until carrying capacity was reached, then take those resources to a warehouse for delivery:

Apologies for the 3mb gif, Hexo doesn’t seem to have a plugin for mp4s

You can see the logic flowing through the nodes in the bottom left, and the amount of items that the agent is carrying in the bottom right.

Using Playmaker for this was okay. Moving an agent to a specific object was very easy, but the action to fire an event when the destination has been reached doesn’t work, it fires instantly instead of waiting for the agent to actually arrive. I found some questionable workarounds for this and decided to put a “is there something in me” listener on the destination object. It worked, but it doesn’t scale very well.

I also feel like managing multiple resource points and warehouses might get complicated quickly. I might spend some time trialling that, but I feel like trying to put all of my game logic inside Playmaker will just cause me problems in the long run, especially since I know how to write code.

I feel like Playmaker would be better used to handle putting agents into the correct state, and then the actions themselves are handled with code. I may have to solicit opinions from people that know more than me.