Unity Visual Scripting Overview | Ekaterina Usova | Skillshare
Drawer
Search

Playback Speed


  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x

Unity Visual Scripting Overview

teacher avatar Ekaterina Usova, Artist

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

    • 1.

      Intro

      1:15

    • 2.

      About Unity Visual Script

      1:27

    • 3.

      Interface Unity Visual Script

      6:22

    • 4.

      Working Visual Script

      6:07

    • 5.

      Change FPS

      2:39

    • 6.

      Graph Variables

      4:45

    • 7.

      Object Variable

      4:09

    • 8.

      Using Visual Scripting

      7:44

    • 9.

      Thank you!

      0:41

  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.

318

Students

2

Projects

About This Class

In this class, we will be talking about Unity Visual Scripting. The class is for beginners, no experience is necessary. All you need is downloaded and installed Unity 2021 on your computer.

This feature allows game creators to create logic and interactions for their games using node-based graphs instead of traditional C-sharp scripts.

  • useful for non-programmers and programmers alike
  • use visual scripting to test and implement various scenarios without having to learn a bunch of potentially complex C-sharp code
  • if you want to learn C#, visual scripting is a very useful tool for this. 

In this course, you'll get to know Unity Visual Scripting and make your first step with this tool.

Meet Your Teacher

Teacher Profile Image

Ekaterina Usova

Artist

Teacher

I am a designer a creator, currently living in Florida USA.  I have a passion for teaching people and creating amazing things. 

Do you want to learn new skills that are in demand right now? Do you choose to create, to be an artist in the modern world? Welcome to my courses!

My courses are designed for such an enthusiastic people as me, who always want to learn more! 

See full profile

Level: Beginner

Class Ratings

Expectations Met?
    Exceeded!
  • 0%
  • Yes
  • 0%
  • Somewhat
  • 0%
  • Not really
  • 0%

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.

Transcripts

1. Intro: Introduction. Hi, my name is Kate, and today I'm excited to share how you can streamline your game development workflows using Unity visual scripting. This feature allows game creators to create logic and interactions for the games using node based graphs instead of traditional C-sharp scripts. This feature is really useful for, for non-programmers and programmers alike. Moreover, you can use visual scripting to test and implement various scenario without having to learn a bunch of potentially complex C-Sharp code. Or if you want to learn C-Sharp visual scripting is a very useful tool for this. Unity, visual scripting is similar. And the more you practice, you'll find that you'll be able to understand C-Sharp code a lot better and eventually jump into using it. And the only thing that you'll have to learn left is the syntax. So if you're ready, let's dive in. 2. About Unity Visual Script: Unit is visual scripting allows you to create the logic for your projects without writing actual code. You already know that traditional scripting and unity, as done in the c-sharp programming language. But visual scripting makes everything easier. It is a visual language that lets you diagram your instructions. For example, these two scripts do the same thing. They're just written into different languages. Visual scripting is a great tool for both known coders and future coders. It makes it easier to learn and understand scripting concepts and even wash your scripts run in real time. It also gives coders a way to better collaborate with artists and designers. Coders can use visual scripting to create extensions, templates, and tools for other unity users so that everyone can customize their unity projects, whether or not they know C-sharp. So this is what visual scripting is and now you know what it can do. So let's get started using visual scripting was something really simple. And the next tutorial. 3. Interface Unity Visual Script: Alright, let's dive into visual scripting. In this lesson, we'll be talking about visual scripting interface. And our first step is to run a 3D project on unity. So here it is, and you project 3D. We can give it a name. Test project and create also make sure that your unit is up to date and if it needs update, update it, I'm using the default to you. If your view is different, that's because you have already rearranged the panels. If you want to go back to the default view, you can open the window tab, then go to Layout. And here you have default. So here we have a scene. We have a camera and the light source. Let's create a coop. Here it is. We will we playing with it? I want to move the cube a little bit so that the camera can see it. Then we can go to the game view and check if the cameras sees our qp. Also, if you click here, main camera, this little window pops up and you can see our cube just the way we see it in the game mode. And now I want to start with sentence symbol in order to demonstrate the visual scripting to you guys. Let's say rotation. So I want to make the cube rotate using visual scripting. So there is a component that runs a visual script. It's called a machine as a component, and the machine will carry out the instructions in the visual script upon the components game object. Let's select the cube and we're going to work with the script machine. Now. Let's go to the Inspector panel, then click Add Component, then go to the visual scripting here and find the script machine. Now, right, so here it is. This is our new component. If we click on camera or any other object, you can see this symbol here on the cube. It shows us that the cube has the script machine component. Alright, let's select the cube again and take a closer look to the script machine component. Pay attention. And the machine is the component attached to the GameObject. And the graph is then asset stored in a separate file of your project that can be used in multiple machines. At this point, the machine is created, but it doesn't yet have a graph assigned to it. Let's create a graph. Let's go to this group machine component and select the new button. This window displays the assets folder of your project acids. So we need to create another folder here, let's say visual scripting. Now open this folder and give this file name rotation. Since we want to work with rotation for our cube, you can see that it has the asset type. Okay? As you can see, the script machine component in the inspector has updated to include fields for title and summary. You can use these fields just the way you want it. For example, let's give this graph that title. The coop and the summary. Make the clue pertains. Alright, and you can see this new button, edit graph. Let's click on it. And here we can see this cribbed graph window. This script graph window appears when you create your first graph in a scene, depending on your current window configuration, it might be undocked. In just like this, it is undocked and I want to pin it somewhere. Let's click here and drag it down next to the project and consult panels. The purpose of such movement is that we can see now this window and our seeing you at the same time. Let's get the script graph window includes three panels. Let's take a closer look at it. First, this one, graph window. This is the area where you will build your graph graph inspector. This one, this is a panel providing additional information about the units in your graph as you edited. For example, if I select this art, you can see that we can see the more information here in the graph inspector. Same for the update. And the third window is Blackboard. This one, this is a panel for creating and managing variables. Right now you can see here a graph variables. We will be talking about it later. You can see that the graph inspector and Blackboard are stacked vertically the first time you open them. But you can rearrange them. You can click on the right and left buttons here, just like this. This one, the small ones. And you can rearrange this panels. For example, lead's molding panel here. Okay, Good job. Now if you are familiar with visual scripting interface and we are ready to create a working visual script in the next lesson. 4. Working Visual Script: In this lesson, we're going to create a working visual script. Right now here in this graph window we have two units, start and update. They are events. As you can see, event, event. You can delete units by selecting and pushing delete button on your keyboard. And in this case, we don't need the start event. This event is triggered once. That's why it's called SART. So it is triggered only once. But we want the cube to rotate all the time. So we will be working with the update event. So I'm going to click the Delete button. And that's it. You can drag and move just like this, your units. And there are three types of the units. Events such as update, flow. They are units that must be triggered by another node to execute and data. There's our units containing data. Sometimes units are called knots. You will probably hear NADH instead of unit. That's the same thing. Alright, so how to add units to your graph? You can see this background. Just right-click on it, add unit. Here you can see the context menu, so-called fuzzy finder. It has a multi-level menu, contain every type of unit. Everything can be found here. In our case, we need to critique the cube, right? So let's type rotate. Rotate. There are many units for rotation, as you can see. But in our case, we need a simple rotation for a 3D object, this one, rotate and three-dimensions. Perfect. We've created the new unit. When it's not selected. It can be dimmed like this. Selected. Done, select it, select it, but you can click here, dim to turn this feature off. Right now, it will be active all the time. Let's select the unit and take a closer look. This, or if you use an older versions, it can be self. And instead of this, that means that this unit controls the game object attached to this graph, we are a machine. The flow arrows indicate the order of hello from unit to unit. Soon you will connect. These two, indicate the order in which you graph will run. Their circles on the left side of the unit, our inputs. These are inputs 1, 2, 3, 4. They are used to move values and objects from unit to unit. The symbols next to the angles, the XY is that angles, this one, blue circles, blue dots are object type indicators for each unit. In this case the blue.me, a floating point number. When you select a unit, detailed information appears in the graph inspector. So you can see the unit is selected. We can go to the graph inspector and read information about it. We also can see you would do the inputs and outputs mean to make units work, we need to connect them. Let's connect these units together just like this. If you need to delete the connection, right-click here, That's it. And like this, to connect again, you can see that here are the numbers. These numbers manage the rotation. In this case, they are all zeros, so the object will not rotate, or actually it will rotate, but, but the end goal will be 0 degrees. So even if I run this script now, I will not see any changes. You also can see that since we are in the game mode right now we are playing the script. You can see this animation here showing how it all works from the update to the Rotate unit. Okay, let's stop it. And now the animation stops these numbers here, in this case, mean degrees per frame. Let's type one, for example. This and play again. Right. Here you go. Something's happening. Let's take something like 0.5 for the y and 0.1 for the zed. Play. Again. You can see the cube is rotating. You can also see here in the inspector panel. Grade, here is your first visual script to write more useful scripts unit variables that can hold various values and objects in your script. Let's do that in the next lesson. 5. Change FPS: Before we dive into variables, let us do one more thing. You see that if we put one here for the number, for the rotation, the cube goes crazy, right? This number means degrees per frame. They are not degrees per second, but per frame. So let's enter the plain mode once again and take a look how many FPS we have. Stats. Can click stat here to see the FPS. Oh my gosh, that's like really high. Right now. It uses everything your computer, a kid and give it it's like 700 frames per second. Let's limit the FPS. And to limit the FPS, we also will be using the visual scripting layer. Let's click here and try to figure it out. We understand that we need to eliminate or set frame rate. So I'm gonna type frame rate. And let's try to find something here. Set target frame rate, that sounds just right. Specify that the frame rate at which unity tries to render your game. We can type the frame rate we need here, 6060 frames per second. It is a basic value. But to make the units work for the project, we need to connect it with other units. I need to set the frame rate up just once and you need to use the start event unit. Knee. I know we deleted it, but we can add it again. Start. Here it is. Start event, the target frame rate. Okay, let's run it once again and take a closer look. Ok, you can see the FBS are now limited. It is something about 60 and the cube doesn't go crazy this time. All right, let's stop here and said, Well, said 11 here. Let's take a look. All right, good. 6. Graph Variables: And now we send to play with variables. We'll start with graph variables here and on the blackboard you can see the graph variables. A big graph variables are related to other graph in which they are defined. You remember that we have saved the graph here. And now our graph variables will be related to this graph. Let's create a graph variable. First, I want to change everything back to 0. It's like this because I'm gonna use the variables to define these numbers. Let's create the new variable. Is like this. Now click on plus and we have this new variable, Let's like a type for this one. So we have several types. For this one, we need this float because you can see this blue dots here, they indicate the type. So it shows us that we need to use this one. Flow type means a floating point number, also known as a decimal number for the value. Let's enter when. Now find this symbol here, we have like two lines here, and drag and drop it here. We've created and get variable unit. This is another unit, get variable. You can see it has the graph kind of variables selected, lead, select this two, and move it higher. Oh, that's too high. Would hire just like this. Okay, and I'm going to drag and drop this get variable here. And now connect this variable with this one. What does it do? So for what? Right now, instead of typing the number here, we define this number through this unit to get variable. And you can see that we no longer have a possibility to type something here for the x angle, because the value is now coming from the get variable unit. Now let's enter the play mode again. You can see that here we have the one. So it means that this one goes from this unit to this unit, to this, to this line one. If you don't need to see this numbers, you can click here values and next to the doom values. And now there is no, no number here anymore. Click again, you can see it. Let's try to change the value while in the play mode. I'm going to type three. And again see that the cube spin it up. We also will see the new number here in the connector. Now let's exit play mode. And what happened? Yes, the value came back to the one because one was the last default value you entered before starting play mode. Variable values revert to their defaults when they are changed in play mode. So you can change, you can make any changes in the play mode. But when you exit the mode and go back, you will see the last numbers you enter it before entering the play mode. Although the inline numbers, this one will be saved. For example, was enter the play mode and change this number to three. X is the mode. It is still 3. Again, this values are called inline and they will be saved if you change them in the play mode. But if you will change anything for the units, variables which define variables like this one, it will not be saved. Let's go to the next type of variables. 7. Object Variable: You noticed that next to the graph variable, there is another tab called object. Here. This is for an object variable. Imagine you're creating the script for someone who needs to control the rotation of the cube without having to edit the script. With object variables, that person can change values from the inspector. Object variables are connected to the game object and can be changed in the inspector. When the game object is selected. Let's create an object variable play here, select the Object tab for the new variable name. Let's use for the y rotate this time. Click on Plus. Again it will be float and value one. We do the same drag and drop like this. With this and connect the values of all which of the variables are changeable in play mode and scene view or gain you. But any changes made in play and mode are lost. Let's take a look. Right now. We have one, I continue to five will be five. So we enter the play mode. We can see it goes five for the object variable. Now if I selected the object value five, Let's change it to 10. You can see the changes immediately. Now, let's quit the play mode. And you can see that it went back to five. Another example. We enter the play mode again. This time we go to the Inspector panel. You can see that these variables panel appeared and it appeared only for the y rotate. That's because this variable as objects variable and not the graph variable. We don't see the x rotate here, right? Because it has graph variable. Let's change it to 10. Again, we can see the changes immediately exit the mode, it goes back. So this is the main difference between graph variable and object variable, because object variables are created to be changed without looking at the script or even visual script. So that person who needs to control this values, they just can't do that from the inspector panel. It's very simple. I also want to show you that if you duplicate an object, the graph, we'll be also duplicate it. Let's select over QB, right-click duplicate. We have the cube one, it's on the same place. Let's move it a little bit. This, okay, So this is the second coop. And you can see that it has the same script machine. It was duplicated. So we'd has the same units, everything, everything that you have created for, for the first game object, you duplicated everything, including the script machine, hour rate, but rotation, you know, it's kind of boring. It's very simple thing to do. In the next lesson. Let's do something more interesting. See you there. 8. Using Visual Scripting: In this lesson, I'm going to show you what you can do with visual scripting. They actually almost anything. Visual scripting is an easier way to code. And I'm going to demonstrate that. So what I did as I inverted this 3D game kit, It's absolutely free. You can download it from Unity Store, Ellen. Okay, so I'm going to draw a drag and drop the character to my scene. Okay, so I don't need the cubes anymore, so I'm gonna delete them. Okay, Good. Her back view. I want the object to turn with my mouse. And then this lesson, let's see how we can do that. When you move your mouse like this, the object, the old hero or in within rotates wealth with your mouse. I have already put the camera closer to the hero so that we can see this rotation. And now let's go to visual scripting. Okay, so I'm going to select the Ellen and add component, the script machine. Here it is. Now, okay, let's create a new graph, title and summary. Let's, let's write down something. First of all, just like wealth, usual scripting, we need to define a logic. So here is my logic. I'm going to use mouse coordinates and the object coordinates. And using these coordinate, I'm going to calculate the rotation angle for a start, I need to set and target frame rate, again. 16. Just like this. Nice. Now I need information about mouse position. And to do that, I need the input. Get access this one. Let's give it a name. Mouse. Because I'm gonna move my mouse like this. And this is the x axis. If you need more space and don't need the scene or the game view, you can double-tap here. And this window will open full screen. So let's add multiply. I'm going to multiply it by 120. So it's twice per second. And I also need the per second. Per second. Okay. So like this, like this. Okay. You can see that when I did that, this unit turned yellow, meaning that Santa is wrong because it should multiply a and B. And I have the B, but I don't have a. And this yellow color shows me that something is wrong. So let's fix that. Like this. Visual scripting can show your mistakes and your script right away. Now, I need a graph variable. Let's give it a name. Mouse picks type will be float, drag and drop it here. Like this, this graph variable will store information of the object position on x-axis. Let's add this together. This very simple. And now we have a new variable. Let's set it. Set a set variable, variable graph. Okay? We can select this mouse X here. And now I need the update event and the need to connect this just like this in order to constantly run the script. Now we can calculate the angle of rotation. First, I'm going to need the lawyer and this one. And then set Local Rotation just like this. The y-axis, because the object will move along the y-axis. And I, of course, if you are new to Unity, you don't know all those units and you don't have to. You are learning. And this is a part of the process. For example, for, for this unit said Local rotation, you can see this sign. This sign tells you that we need something like, like this. And you can see that this unit has the same sign. So we can connect this two units. Let's connect this like this, and try to enter the play mode. I'm going to close this. And I'm moving my mouse just like this, and the object is turning. If I move along the y-axis, nothing's happening. But the x-axis works just fine. Let's try to put it to another axis. Just to take a look. For example, x. Okay, Let's take a look. So now you see that what's happening? I'm moving my mouse, moving my mouse along the x, x axis and the object is rotating in a different way because I changed the axis. Let's check it too. Just in case, you know, it's fun. Okay, Here she is. And again, visual scripting helps you a lot. You can see here how every unit connected with other unit. And if you forgot some ten, you can see was wrong. For example, if I take this unit and delete the name like this, and run this script, again. This unit will turn red, showing us that something's wrong. And you can see here, input axis is not set up. Also, this game, it will not work because Santa Ynez wrong. So yeah, that's why visual scripting will help you learn unity and will help you progress in scripting. 9. Thank you!: As you can see from this tutorial visual scripting can be useful learning tool that presents code as a logical diagram instead of a potential a cryptic language. But although visual scripting as more simple as still requires practice to get used to it when creating a project. Use Unity manual, his Google seek and find answers, and that will move you forward. Let's see what you can do with the visual scripting. Create your own project and share it in the project gallery. You'll find it below. I hope you enjoyed this tutorial and l see you next time.