
Master the fundamentals of writing and reading C-Sharp scripts inside Unity to customize components and assets, connect scripts to Unity projects, and improve your workflow.
Learn scripting in Unity and start programming with fundamentals designed for beginners, including artists, designers, and producers, who want to bring designs to life in code.
Explore Unity programming fundamentals by setting up the development environment, writing a first C-sharp script, and mastering object oriented concepts, Unity specific objects, and script interaction within a game scene.
Choose any Unity version for this course; it centers on C-Sharp Unity and the same development platform. Install Unity if needed and use Visual Studio Community Edition.
Visit the Unity download archive, pick the older version, and run the installer. Install Unity, documentation, standard assets, and Visual Studio Community Edition, then code in C#.
Download Visual Studio Community from the official site, then on the workloads page select mobile and gaming and check game development with Unity to enable Unity tooling for coding.
Create a new Unity project and write a C# script using the start method and debug log to print a message to the Unity console, attached to a game object.
Configure Unity to open scripts in Visual Studio by setting external script editor to Visual Studio 2017 Community in preferences, and browse to the program file if needed.
Explore four basic commands and the basic syntax rules that structure code. Learn data collection concepts, including arrays and lists, and practice reading code by context.
Explore the four basic commands in Unity programming—declare variables, assign data, refer to other code, and evaluate conditions—with emphasis on semicolons ending each command in C#.
Declare a variable by specifying its type and name, followed by a semicolon. Use bool, int, float, and string as common types; make them public to view in the inspector.
Explore the full spectrum of value types in Unity programming fundamentals, from boolean and byte types to long and ulong, with floating-point options and Unicode char and string representations.
Assign data to variables with the assignment operator, combining declaration and initialization, and perform implicit and explicit conversions, including type casting, during assignment.
Learn how arithmetic and assignment operators work in Unity, including addition, subtraction, multiplication, division, and modulo; explore short forms like plus equals and increment, and string concatenation with plus.
Explore how method return types determine what data a method passes back. Use return statements to pass values, end methods early, and make methods dynamic with parameters and data types.
Learn how to make Unity methods flexible by adding parameters, passing values like strings and integers, and managing scope to distinguish between parameters and class variables.
Discover how value type parameters copy data when passed into a method, so the original variable remains unchanged. Use return values to propagate changes and understand scope in Unity.
Explore conditional logic in Unity using if, if-else, and else-if chains to control code execution based on boolean data, game state, and conditional operators.
Explore how to use conditional operators in Unity to compare values, such as health and currency, and combine conditions with and, or, and parentheses.
Learn to replace lengthy if statements with a switch using a variable and case blocks. Use breaks and a default to control game logic and log debug logs.
Learn how while loops repeat code while a condition is true in Unity, and how do while loops run at least once before checking the condition.
Learn to use a for loop in Unity to run code a fixed number of times by combining initialization, condition, and increment. Compare with while and note for each later.
Examine arrays and lists as data structures, focusing on zero-based indexing, element access, and initialization. Learn fixed-size arrays, length checks, and for and foreach iteration in Unity.
Learn how lists offer flexible dynamic collections with type-safe elements, including creation, pre-population, and conversion to arrays, and perform add, insert, and remove operations, while counting elements and managing capacity.
Explore how the C# language underpins object oriented programming, including class structure, inheritance, instances, and value versus reference types, and learn naming and readability best practices for clean, maintainable code.
Explore encapsulation, abstraction, inheritance, and polymorphism in object oriented programming. Learn how classes and objects use public members and the dot operator, with Unity components and the inspector.
Explore the default C# class structure in Unity, including class declarations, members, and curly brackets, and learn how using directives and namespaces shape component scripts.
Declare a class with the class keyword and a name, use public for access, and optionally inherit from MonoBehaviour with a colon; explore single inheritance and interface implementation.
Understand how classes function as templates and how instances materialize in Unity, using a population variable, constructors, and components to power runtime behavior.
Learn how inheritance lets a derived class inherit base class members, and how polymorphism lets a base-type variable hold derived objects, enabling shared behavior while extending dog-specific features.
Explore how abstract classes cannot be instantiated and how abstract methods must be overridden in derived classes, and how virtual and override methods enable selective customization across inheritance.
Understand value types and reference types, including how copies differ from shared references, how memory addresses work, and how passing by value or by reference changes variables and objects.
Structs are defined like classes but behave as value types; assigning a struct copies its values, so changes to one copy don't affect the other, and structs cannot inherit.
Use camel case for variables and parameters, and pascal case for methods and classes. Favor nouns for variables, verbs for methods, and avoid starting names with numerals or mixing types.
Follow clean code practices in Unity programming fundamentals: keep curly brackets on their own lines, write one command per line, indent continuation lines, and use // comments to explain why.
Explore how basic programming in C Sharp integrates with Unity by examining public variables in the inspector, components as class instances, and core Unity structures for game objects.
Explore the Unity scripting API by examining public variables and methods, properties, constructors with new, and static members; learn how interfaces, operators, and inherited members shape class behavior.
Explore vector2, vector3, and vector4 in Unity, including x,y,z,w components and properties like up, right, forward, all ones, all zeros, with operations such as addition, magnitude, distance, lerp, and angle.
Learn how quaternions drive Unity transform rotations to prevent gimbal lock, convert between quaternions and Vector3 with Euler angles, and use identity, FromToRotation, and inverse operations.
Explore Unity's color struct and Color32, using RGBA values from 0–255 or 0–1, with constructors, static colors like black, red, blue, green, gray, and clear, plus lerp and color conversion.
Utilize the Unity MonoBehaviour base class to handle lifecycle messages—awake, start, update, fixed update—and access gameObject, transform, and other components via get component.
Identify the core Unity scene element: the game object, with its name, tag, active state, layer, and transform. Access components, add new ones, and instantiate or destroy objects.
Explore how the transform component manages local and global position, rotation, and scale in a Unity scene, using vectors, Euler angles, and transform methods.
Explore the five main ways objects reference one another in Unity, enabling interaction through public variables, get component method, parent-child relationships, physics and collisions, casting, and find object methods.
Explore using inspector public variables in Unity to wire two game objects, via a reference target component, with runtime checks to avoid null references and log assignments.
Use GetComponent<T>() to fetch a component on the same game object and cache reference for reuse. Expose a public reference target, perform null checks, and verify results with debug logs.
Master accessing components in Unity via parent–child relationships, using get component in parent and get components in children, and transform-based approaches to locate the reference target component.
Explore how collisions and triggers work in Unity by using colliders and rigidbodies, handling OnCollisionEnter and OnTriggerEnter to access the other object's transform, collider, and components.
Explore recast ray casting in Unity by shooting rays from a source or camera through the mouse, capturing hit info with out parameters, including colliders, and accessing hit components.
Discover how find methods in Unity search the entire scene by name, type, or tag, offering a last resort when other references fail, with caution on performance.
Explore how scripts and components interact with Unity scenes, from attaching to existing objects to creating new ones and using data-driven classes and asset-based instances.
Learn how scripts become components in Unity by creating a player script, attaching it to a capsule, and adding components via drag, inspector, or code with gameObject.AddComponent.
Create game objects in code by instantiating new objects or prefabs, assign them to variables, attach components, and use transforms to position, rotate, or clone instances.
Explore data classes in Unity by creating non-mono behaviors with constructors, customize default values for items like ropes, and use this to initialize inventories and handle different item configurations.
Apply the System.Serializable attribute to classes to expose their public variables in the inspector, enabling inventory items like rope to display and customize data during gameplay.
Explore scriptable objects in unity to separate data from runtime code, create editable assets via createassetmenu, and manage inventory items like ropes with persistent, configurable settings.
Do you:
This course is for you!
In Unity Programming Fundamentals, instructor Benjamin Marshalkowski (from Board To Bits YouTube tutorials) takes you through the basics of programming, C# as a language and writing custom scripts to work within the Unity Engine. You'll learn about:
Course features: