Learn to Program with C# – STRUCTS VS CLASSES – Advanced Unity Tutorial


In this video we take a look at classes and structs in C# for Unity! For more information and in-depth knowledge of C# and Unity, check out The Unity C# Survival Guide, available at


► Discord

► Subscribe


Want to learn to make games?
Unity C# Tutorial for Beginners –
Unity C# Tutorial Intermediate –
Unity C# Tutorial Advanced Coding –

Have a tutorial suggestion? Send it to us on GameDevHQ.com.

Social Media Profiles
Website: unity 2018 tutorial



  1. So far in this series, nothing advanced. This is beginner stuff.
    If you aren't teaching this in beginner tutorials, you're doing it wrong.

  2. You can also create a Init() method in the struct with some parameters and call it from Start. Not much difference in general, just a matter of ordered processes

  3. This is informative, but doesn't touch at all on the most important difference between C# classes and structs, which is that classes are reference types and structs are value types. The two behave very differently when they are passed as parameters up/down the stack. They're allocated differently (structs typically on the stack and classes on the heap) and this has many performance implications (garbage collection, for one). There are many factors to consider – far beyond inheritance and overall data size.

  4. This is how I want to be explained. Exactly how you did in this video with a simple example. I might want to buy your book.

    But your book is incomplete! Finish it now! A book that includes an actual explanation about structures!

  5. Thank you. After watching your video I got my struct to work in Unity. I needed to make the individual components public…should have known that but forgot. Your style of explanation for coding is better than most I've seen – you don't waste time, you explain important differences or aspects, and you show exactly the coding to accomplish the goal while discussing the aspect or difference. Great job.

  6. Super helpful, learned so many new things (even though I've been using unity c# for 2 years)!
    Had no idea you could use classes like that, makes it so simple to make different kinds of enemies for my game!
    Thank you! 😀

  7. I learnt this for AS3 and i think JAVA but nothing so informative as you presented… Wicked sic… Need to see a video on how to ACTUALLY break this down for gaming reasons….
    i mean how to know when its a class or a single entity…
    how to group these…

    Maybe we pick a pretty intense 2d game  and bisect it and see what options would go together and from that maybe some of us dont go down the rabbit hole…..me…LOL 

    PS WRONG or RIGHT… i use alot of RPG books (desktop games) to get an idea of what things group.. this good practice or bad… Time and originality vs What works and Time.. ..

  8. Even know I have knowledge of this stuff, your videos are always great to watch even just to familiarise myself. Great job man!


Please enter your comment!
Please enter your name here