How to Make a Game with Visual Scripting (E01) - Getting Started - Unity 2021 Tutorial (Bolt)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

I'm interested in Bolt because I have a LOT of RPG Maker and GameMaker background so Visual Scripting is helpful to me, but I also don't want to be dragged by it in the future if I eventually hone my C#... Is it possible to mix both, lots of Volt with lots of C#? What ARE the downsides of Bolt?

👍︎︎ 2 👤︎︎ u/Bro_miscuous 📅︎︎ Apr 09 2021 🗫︎ replies
Captions
this is the first part out of three of making your first game with no code using visual scripting and in this series we're going to be making this game you might have seen this game from one of Brackeys tutorial but in this series we're not going to be using code instead we're going to be using visual scripting i'm going to be using unity for this series and the version that i'm going to be using is 2021 so if you want to follow along make sure you have a version 2021 installed and we'll start a new project by selecting in this version it's going to be 3d project and the project name i'll just call it the cube let's create it the goal for the first part is to set up our scene for our game and also add player movement in this new project we're gonna go to hierarchy and right click to bring a drop down menu and we'll go under 3d objects and add a cube so this is going to be our ground and we can rename it right away the hierarchy has the list of all the game objects that are inside of our scene and this in the middle is our current scene on the right side we have the inspector for this game object so you can see that the ground object is currently selected and in this inspector you can find components so all of these groups right here are called components the very top component is a transform and this component is responsible for position rotation and scale so i want to scale this ground to cover more space so i'll scale x to 15 and you can see that x is this red arrow right here in this 3d space and you can also see it right here now let's scale this ground in the z-axis so for z let's set it to 1000 and that's going to be our ground let's go to hierarchy and add our player now it's also going to be a cube we'll name it player and currently the player is in the ground so we can use this arrow right here to bring it up above our ground to change the color we can go to the project files right here assets and we can right click to bring a menu here and in this menu we want to select a material we'll call it player material when we have the material selected in the inspector we have settings for this material and we want to change the color so click on this white color we'll change it to red now we have a red material and to assign the material to this cube we can simply drag and drop on this object either in the scene or we can drag and drop it in our hierarchy another option that you have is by selecting a player and dragging this material into our inspector and that also changes to red now to test your game you can click play right here and currently our game doesn't do anything so let's add some physics to our player object by default when you create a cube we get a box collider with it which is one of the physics components a box collider is one of the collision shapes that we have in unity and if we click edit collider you can see the shape here you can resize it to what you like but our collider is good and we're going to leave it as that now to add gravity to our player we can click add component right here and what we're looking for is the rigid body the rigid body makes her player dynamic and since the ground also has a box collider now if we test the game you can see that our player falls down on the ground so we already have a ground or player and now let's add an obstacle for the obstacle i'm gonna use the same setup as i have for the player so what you can do to make it faster is select the player and if you press ctrl d on the keyboard that object that you had selected will be duplicated and now we can move it forward rename it to obstacle and let's change the color of our obstacle right click in the assets folder create material and this is going to be our obstacle material for the color we're going to select a light gray and let's drag and drop it on our obstacle now in our hierarchy we have a main camera and currently you can see that the main camera is located right here in back of this cube so what we're going to do in the game is move our player in this direction in the positive z also when we have the camera selected we can see the preview of that camera and we can move the camera around to change the angle of our shot and also you can rotate it down and get the shot that you like if you want to see a bigger preview of this shot you can go to game and that's going to display what we have right now now currently both of these objects are in the air and we want to position them on the ground so to do that we can go and set y to 1 and we can do the same thing for our player in the asset folder we already have two materials so let's go ahead and clean this up by adding another folder we'll call it materials and move both of these materials into the folder now that we have a simple scene set up we can start looking at player movement and in the series we're not going to be using code instead we're going to be using the visual scripting and that is why i'm using a version 2021 unc added visual scripting into this version if you use previous versions of unity you need to import a package called bolt but if you're using version 2021 or above you don't have to import any packages so to add move logic for our player we can select our player and go to inspector click add component and we're looking for a script machine so like that this will add two components we have the variable components right here and the script machine component we're gonna set up some variables later on but for now we're to work with the script machine so in the script machine for source we have two options embedded or graph if we select embedded then the logic that we'll create only exists in this game object but if you use a graph option a new file is going to be created and you can reuse this graph with other game object as well so let's create a new graph i'll call it player graph and now we have the option for edit graph once you click edit graph for the first time units is going to go ahead and import all the packages that are necessary for visual scripting it will have to do only once in the new project in this new graph right here in the middle we have these two units a start unit event and an update unit event the start event is going to be called only once per object when the game object goes to active state for the first time but the update event is going to be triggered every single frame when the game object is active to find and add other units to your graph you can right click on the graph and you can search for a specific unit the units are also grouped into categories so if you're not sure what it's called you can browse through the categories and find what you're looking for one more event that i'm going to mention is the fixed update the fixed update is a little bit different than update and the main use for the fixed update is for physics so if you want to do any interaction with the physics then you want to use the fixed update instead of the update in our case we want to get this cube to move so we actually want to work with physics two of the options that we have to move our player is to add force or set velocity and to find exactly what you want to use you can right click on the graph and search for one of those words so let's look for force we have all of these units that are available for us and since we know our player has a rigid body we can use one of these rigid body and force so let's click the first one right here and like that we add another unit so in this unit we have some value inputs and you can see the value inputs are these circle inputs right here and the triangle that we have right here is a flow input and for this unit to do anything we need to actually connect it to a output flow and these three events actually output flow since we're working with physics we're gonna use the fixed update let's connect that right here for the force we want to move in the z direction so let's set the z direction to 10 and for the mode the options that we have is force acceleration impulse and velocity change force is going to take the mass of our object into consideration while acceleration is going to ignore that let's actually use acceleration in our case and with this let's go and test it out as soon as the game starts you can see that the player starts rolling but we want our player to slide the reason why our player is rolling is because there is friction between ground and the player and with the acceleration that we're applying to the player it makes the player start rolling to remove the friction between player and the ground we can go to our assets or right click and create a new asset physics material we're going to call this one no friction and in the inspector we have some settings for this asset so we can set dynamic friction to zero let's also set static friction to zero and for the friction combined by default it's set to average meaning that's gonna take the average between the two surfaces for the friction so our ground still has friction and our player doesn't it will end up still having friction the options that we have here is instead of average we can just go minimum so it's going to select the smallest friction and use that value in the physics calculation now let's select the player and how you use this physic material is by connecting it on the box collider so right here for material we can connect no friction and now our cube is sliding instead of rotating that's good now the player is using acceleration to move and that means that our player is going to be moving faster and faster so the other option that i mentioned is using velocity we can search for velocity and you can see that we have rigid body set velocity let's add that in and with the velocity we can actually set a specific speed that we want our player to move in the z direction so let's set it to 20 and instead of connecting to and force let's connect it to set velocity you can remove any unit by selecting and pressing delete on the keyboard and now as soon as the game starts the player starts traveling at that velocity so you can use the option that you want but i'm going to go with velocity for this series with the current setup there's a slight problem and it is with gravity so if i pick up my player in y direction you can see that the player is actually floating in air instead of falling down with gravity and the reason why that happens is because i reset the rigid body velocity back to zero so whatever gravity is trying to do with velocity i'm resetting it back to zero which makes my player float to get the gravity to work again i need to get the current velocity in y direction and pass that instead of the zero we can look for velocity and right here we have rigid body get velocity we get an output of a vector 3 and the vector 3 has those three components x y and z but we only need to get the y value so i can drag this to the side and look for and get y and right there at the top i have an option for vector3 get y and this returns a float value which we can use for the y the problem now is that the set velocity is looking for a vector three and i need to combine this value with the speed that i want to move so what we can do is drag it out and add another unit the one i'm going to use is create vector three and this one has an x y and z values that can be passed in so let's add that in and i can pass in the y value from our get velocity and for z i can set it to 20. now if we test it we can see that the gravity is working again so now we can place our player down to the ground now that we got our player to move forward we can add some keyboard input to move the player from side to side so let's go back to our graph and for keyboard input we can look for input and some of the options that we have here is get key but the easier option to go with is by using get access and in this unit we have one input a string and it's the access name the access name that i'm going to use is horizontal and the place where you can find the access name you can go to project settings and under input manager we have list of axes that are available and right here we have horizontal which is controlled by the left and right button and also alternative with a and d and there's lots more access names that are available here now this is the legacy input system and if you want to see how to set up with the new input system i'll create a bonus video after the series and in that video i'll show how to convert from the legacy input system to the new input system now the value that we're going to get from this unit is a float and is going to be between a negative one and one that works perfectly for us because we want to move our player either in the negative x direction or in the positive x direction but we want to move a little bit faster than one unit per second and to increase that speed we can use the multiply unit and here we can multiply by the speed we want to move in the x direction so let's set it to 10 for now and connect it to our x input of our vector 3. and now we can use a or d or the errors to move our player side to side now be nice if we can control the speed of our player from the inspector and we actually can use variables to set that up so how we can do that is go back to our graph and right here we have different variables that we can use the variables that are displayed in the inspector are object variables so we can go to the object tab and we can add some variables i'll name the first variable forward speed for the type this is going to be a float and for the value let's set it to 20. now you can drag this variable and put it in the graph and instead of using that hard-coded 20 value we can use the value of this variable we can do the same thing for the side speed and the variable float let's make it 10 drag it into our graph and connect it instead of the 10 that we have here if we now take a look at the inspector under variables we can see both of those variables and we'll be able to modify them later from here now the last thing that we're going to do in this part is get our camera to follow our player and to do that i'm going to use cinemachine that's a package that provided by unity so we can go to window package manager select unity registry and we can search for cinemachine click install we can close this window and now we can go to our hierarchy and right here we have a new option a cinemachine so we can add a 2d camera in the inspector for this object that we just created we can see a follow option we want to pass player as the follow option so let's drag the player object into the follow option and now our camera is going to follow our player if we take a look at the game preview you can see that the angle is the exact angle that we were viewing our scene in so it copied our scene view to our virtual camera so if we want to reset it back to default we can go into the inspector under transform click reset and that's going to reset the settings back to zero zero now i can rotate this virtual camera to where i want it to be positioned and if you want to get the camera closer to the player there's an option for camera distance so adjust that and it's going to get our camera closer to the player you can see this red and blue overlay and this because we have the virtual camera selected so if you don't want to see that overlay just deselect all of the objects and that should go away now let's click play and see if our camera is following our player and there we go we got our camera to follow our player now we have the skybox in the background to change it to a solid color we can go to main camera and right here in the camera options we can switch from skybox to solid color and then we can select the background color that we want to use so let's use something like that and with this we're going to wrap up with this part in the next part we're going to create the game loop so we'll look at some collisions how to restart the level and also add coins that we'll be able to collect
Info
Channel: Smart Penguins - GameDev
Views: 50,303
Rating: undefined out of 5
Keywords: Tutorials, GameDev, Smart Penguins, unity, unity game dev, indie gamedev, indie game devlog, game devblog, how to make a game, how to, develop games, brackeys, game making, game development, indie game, video game, beginner, learn, course, game, basic, visual scripting, making games, getting started, unity bolt, how to make a game with unity, unity bolt tutorial, unity visual scripting tutorial, unity visual scripting 2021, how to make a game with visual scripting, unity no code
Id: KcAu65n3idI
Channel Id: undefined
Length: 14min 52sec (892 seconds)
Published: Thu Apr 08 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.