Playmaker for Unity
Levi D. Smith
DevSpace Conference
Huntsville, Alabama
October 2015
Slide 2
Slide 2 text
About Me
• Hobbyist Game Developer since 1995
• Unity and other environments
• Ludum Dare participant
• Occasional Knoxville Game Design speaker
Slide 3
Slide 3 text
About Unity
• Free
• Unity 5 Personal
• Pro License
• Build for multiple platforms
Slide 4
Slide 4 text
Playmaker Background
• Cost: $95
– Often discounted
• Requires Unity 3.5 or higher
• Created by Hutong Games (@HutongGames)
– Alex Chouls and Erin Ko
•玩
Slide 5
Slide 5 text
Getting Started
• Unity Asset Store
• https://www.assetstore.
unity3d.com
Slide 6
Slide 6 text
Enabling Playmaker
• New menu item
• Select Playmaker Editor
• Playmaker pane
Slide 7
Slide 7 text
Editor Pane
• FSM State Diagram
• FSM
• State
• Events
• Variables
• Preferences
Slide 8
Slide 8 text
Creating an FSM
• FSM (Finite State Machine)
– Zero to many FSMs
– States
– Events
– Transitions
– Variables
• Creating New FSM
Slide 9
Slide 9 text
States
• Examples
– Light Bulb
– Game Character
• Only active at a time
• Contains a collection of actions
• Actions executed top to bottom
Slide 10
Slide 10 text
More on States, Events, and
Variables
• Active is highlighted
• Manually transition to state
• Global Events
• Global variables
Slide 11
Slide 11 text
Action Browser
• Standard Unity methods
• Additional helpful methods
• Actions are “Code”
• Execute Scripts
Slide 12
Slide 12 text
Using Actions
• Every Frame
– Similar to Update
• Send Event
• Delay value
– Avoid infinite loops
• Find Game Object
Slide 13
Slide 13 text
Managing Actions
• Disabling actions
• Copy and paste into FSMs
• Navigate with Project
hierarchy
• Lock an FSM
• Show debug values
Operator Actions
• Number comparison
– Most data types
• Boolean comparison
• Events for each comparison
• String operators
Slide 16
Slide 16 text
ArrayMaker
• Storing array type information
• Not included with Playmaker
• Downloadable from Playmaker website
– https://hutonggames.fogbugz.com/?W715
Slide 17
Slide 17 text
Making a Light Bulb
• Create FSM
• Off and On states
• MOUSE DOWN transitions
• Point light as a child
• Activate Game Object actions
Slide 18
Slide 18 text
Moving a block
• Add cube
• Add a RigidBody
• Add a PlayMaker FSM
• Add Moving State
• Input > Get Axis
– Transform > Translate
• Or Get Axis Vector
– Map to Plane
• Order of actions is
important
• Double line button to
toggle
– Constant values
– Variables
Slide 19
Slide 19 text
Follow Camera
• Add FSM to Camera
• Smooth Follow Action
• Target to player
• Set Damping
Slide 20
Slide 20 text
Character Tips
• Capsule collider
• Freeze rotation axis
– Avoid “falling over”
• Default terrain map
– Zero to 600
• Character controller vs
Rigid Body
Slide 21
Slide 21 text
Jumping
• Idle State
• Jumping state
• jump event
• Get Button Down action
– Send jump event
– Transition to Jumping
• Add Force action
• Transition back to Idle
• Self / World space
Slide 22
Slide 22 text
First Person View
• Disable Smooth Follow Action
• Set Parent action
• Set the Camera’s Parent to player
Slide 23
Slide 23 text
First Person Controls
• Mouse Look action
• Action must be on the
player object, not the
camera!
• Uses airplane joystick
view control by default
• Sensitivity values
– Negative Y for traditional
controls