In this video, I show you how to create and code a random binary path which I use for our ZigZag tutorial series. A random binary path is an infinitely generating path that randomly changes directions between two directions.
In this video, I only show you how to create the initial segments of the starting platform. For this tutorial, we will talk about for loops, if statements, instantiation, and the random range function.
In this Unity tutorial for beginners, I will teach you how to create a very cool 3D character selection menu. This menu system uses 3D models of the character to display what the players are selecting. This tutorial for beginners will teach you about all different UI components and the code behind it.
Working in Unity
To begin we will start in Unity. You will need to have the 3D models that you want to be selectable. You need to have these 3D models in line with each other and make sure they are evenly spaced from one another. We will then create a World Space Canvas, scale it down and position and rotate so that it is floating above or in front of the 3D models. We will then create what is called a scrollrect or a scroll view. This is an image object the allows you to slide the UI objects that are children to the Scroll View. For the content of the Scrollrect we will have a UI image that overlaps the 3D models. We will then create UI buttons, one for each Character, and place the buttons over top of each 3D model. The last thing that we need to do is make our character models children to our content object.
Coding a Selection Menu
Now that we have Unity all set up for this tutorial we will talk about the code. We will need two scripts for this Game mechanic. The first will be called the StoreController and the other will be call StoreButton. In the store controller script, we will create code that will lerp our content object to a new position vector3 variable. In the StoreButton script, we will create two functions one that will set an int variable that we can then later use to instantiate the right character model for our player in the multiplayer scene. The second function will be for measuring the distance between the button selected and the center of our scrollrect. We will then use this distance to set the new position variable of our StoreController script.
More Unity
Once back in Unity we will need to apply these scripts. The StoreController script can be attached to our scroll view object and our StoreButton script can be attached to each of the buttons. We then need to set our variable and apply the functions of our StoreButton scripts to the On Click events of our UI buttons.
Test the Game
Finally, we can test our game. You should be able to scroll all your character to the left and right and you should be able to click on each character which will center them in our scene.
For this tutorial, we will be teaching you how to make a player movement controller for a top-down shooter video game. We will be working with Unity 2018 to create this movement controller. This controller is what we are using for our Season 001 project which will be a top-down space shooter.
After teaching how to make this controller for a single-player game. We will then teach you how to make it into a controller that will work across a multiplayer network that will work in a multiplayer game.