From the course: Learning Unity 2D Scripting

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Attaching scripts

Attaching scripts - Unity Tutorial

From the course: Learning Unity 2D Scripting

Start my 1-month free trial

Attaching scripts

- [Teacher] Now that we have a game object in our scene, let's talk about adding a script to it. If we select the New Sprite in the hierarchy, you'll see a button that says add component at the bottom of the inspector. If we click on this, we can create a new script by scrolling to the bottom of the list and selecting new script from the option. One thing to keep in mind though is that when we create new scripts like this, they'll be placed at the root of our project folder. The other way to create scripts in order to keep our project more organized is to actually go into the scripts folder which we created earlier, right click, and select create C sharp script. There are two languages you can use in Unity. Javascript if you come from more of a web background or C sharp script if you come from a dot net background. Both languages expose the same level of APIs although C sharp allows you a little more control over how the game runs and is more perform end. If your background is in…

Contents