© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2024
C. HardmanGame Programming with Unity and C#https://doi.org/10.1007/978-1-4842-9720-9_10

10. Working with Scripts

Casey Hardman1  
(1)
West Palm Beach, FL, USA
 

Now that you’ve learned about the basics of objects, let’s learn about scripts. I should warn you – we’re getting dangerously close to coding our first game.

Scripts are components for our code files. They get our code into the game. We’ve worked with a script already (MyScript) just to get our code running, but we haven’t explored them thoroughly yet.

When it comes down to it, they’re objects. A script is a code file that declares a class. The class acts as a component, allowing us to attach it to GameObjects ...

Get Game Programming with Unity and C#: A Complete Beginner’s Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.