In this article, I will show you how to make a game object move in five minutes or less using the PlayMaker add-on for Unity, with no code.
If you haven't already, head over to the Unity website and download the latest version of Unity. Unity is a free, user-friendly game engine that allows developers and studios to create 3D games for Android, iOS, Windows, and over 20 other platforms.
What exactly is PlayMaker? PlayMaker is a paid add-on for Unity that allows you to create games without having to code. Created by Hutong Games, PlayMaker uses functional state machines (FSM) to add physics, animation, interactive objects and scene changes easily. Their developers have already created the scripts for you, which can significantly cut your game development time in half. As of writing this tutorial, the current price is $65.00, with over 370 five-star reviews.
Once you have Unity, create a new 3D project. I made a simple scene with a terrain and a sphere. In the main viewport, under the menu toolbar, you will find the Asset Store tab. Type PlayMaker into your search box. Follow the instructions to place your purchase. You may need to use the link in your confirmation email or import it directly through Unity. You may find that it takes you back to the asset store, but don't worry—click Add to Cart and it should give you the download option.
Download the file and unzip it into a folder you can easily find. Now let's import a custom package by going to Assets > Custom Package and opening your unzipped PlayMaker file.
After you've imported the package, choose Install PlayMaker. This will add the PlayMaker option in your menu bar.
Every FSM needs to be attached to an object. In this case, our sphere will be the object we are looking to control. Later, we will need to specify our game object once an action is created. For now, let's confirm our sphere has a rigid body. In addition, let's freeze the X and Y position of our sphere in the Inspector window.
The PlayMaker Editor
Go to the PlayMaker tab on your top menu bar and click PlayMaker editor. This will open the below window. Click and drag the tab to place it next to your Game tab on the bottom.
On the right of the editor window, you will see four tabs:
This is where you will choose the options and parameters for your state. Along with changing the name, you can add in your own description, which comes in handy when you have large projects. For example, this state will move the ball left.
To add a state machine to an object, choose your object in the Hierarchy. Head over to the Editor window and right click to add an FSM. This begins the state machine, and this will be state one.
Second, we need to create a System Event (what happens after user interaction). This is what will set off the state, for example button clicked or mouse over. For this project, we will choose mouse over.
Let's create our next state and name it Ball Moves. You will immediately see a red exclamation point; this is because once you create a state, you will have to define a transition. To define a transition from one state to the other, right-click and choose Transition Target. There you will see the name of the second state you created. You will now see an arrow connecting your two states.
It's time to add physics to our object. The way we do this is by activating the Action Browser. There are numerous actions you can choose for your object, which is pretty cool.
Feel free to look around at all of the commands you can use in your project. For every action, we will need to set up parameters.
In order to make our sphere move, we will need to give it force and velocity through the Action Browser. First, make sure the proper state is chosen. To search for an action, type it in the search box. Let's search for add force. Under the State tab to the right, change the Y variable to 100.
Now let's add velocity by repeating the steps above. Change the Y variable to 50.
Hit play and voila! Your sphere should move towards the camera. There are almost an unlimited amount of actions you can perform simply with PlayMaker once you understand the interface.
In my opinion, PlayMaker is a great addition to Unity. Even if you do have coding experience, it can make it that much easier to create interactive, fully animated games in half the time.
Unity has an active economy. There are many other products that help you build out your project. The nature of the platform also makes it a great option from which you can better your skills. Whatever the case, you can see what we have available in the Envato Market.
If you are a beginner, once you learn the interface you can vastly improve your learning curve. PlayMaker also has a very active community, where you can find questions and answers from users.
Subscribe below and we’ll send you a weekly email summary of all new Game Development tutorials. Never miss out on learning about the next big thing.Update me weekly
Envato Tuts+ tutorials are translated into other languages by our community members—you can be involved too!Translate this post