๐ Learn ALL about C#! https://cmonkey.co/csharpcourse
โ Get my Problem Solving Course! https://cmonkey.co/problemsolving
๐ฅ Learn how to make ANY game! https://cmonkey.co/practicepack
๐ FREE Complete Courses! https://cmonkey.co/freecourses
โ FREE Game Dev Insights! https://cmonkey.co/gamedevreportnewsletter
๐ฎ Get my Code Monkey Toolkit! https://cmonkey.co/toolkit
๐ Join my Game Dev Practice Lab FREE! https://cmonkey.co/practicelab
๐ด RELATED VIDEOS ๐ด
How to Write High Quality Code that doesn't fall apart. https://www.youtube.com/watch?v=m0s3IUrWzVQ
Learn how to write PRO level code with this DEEP DIVE! https://www.youtube.com/watch?v=RXf1jsXxWkg
How REAL Developers Build Complex Games! https://www.youtube.com/watch?v=4kg2N-t2tWI
Optimization is awesome, but do NOT make this mistake! https://www.youtube.com/watch?v=vhflNElicXU
Learn C# FREE Tutorial Course Beginner to Advanced! [12 HOURS] https://www.youtube.com/watch?v=qZpMX8Re_2Q
How to Write High Quality Code that doesn't fall apart. https://www.youtube.com/watch?v=m0s3IUrWzVQ
Learn Problem Solving (FREE Course, MOST VALUABLE skill) https://www.youtube.com/watch?v=Jgw5Z40Q1vc
Escape Tutorial HELL with my Game Dev Practice Lab! https://www.youtube.com/watch?v=Ng0VH0SmqRo
๐ฌ Your code compiles and the game works, so why bother refactoring? I use a small shop prototype to show how working code can still be difficult to maintain. Let's clean up confusing names, brittle string IDs, and mixed responsibilities without trying to rewrite everything at once.
TIMESTAMPS
00:00 Intro
05:49 Refactoring in small, testable steps
07:11 Inspecting the shop prototype
08:19 Improving variable names
09:27 Renaming fields without losing references
14:23 Private fields and SerializeField
17:05 Consistent code formatting
17:46 Renaming functions and clarifying responsibilities
21:16 Switching to the Input System
22:58 Replacing PlayerPrefs with a shop inventory
25:02 Grouping related data into classes and lists
27:44 Inventory restocking and references
29:41 Reading and spending inventory items
31:54 Replacing string item IDs with enums
35:17 Giving state machine states meaningful names
38:03 Removing remaining PlayerPrefs and saving
39:01 Separating checkout stats UI from logic
40:59 Updating UI through events
43:09 Fixing initialization order with Awake and Start
43:48 Separating customer order UI
44:35 Modeling customer orders with plain C# classes
48:45 Customer order events and custom event data
50:44 Removing magic numbers from the patience bar
51:54 Polling versus events for UI updates
53:19 Moving audio into its own class
54:57 Separating customer visuals and animator constants
57:18 Further refactoring opportunities
๐ Some Links are Affiliate links which means it costs the same to you and I get a nice commission. Thanks for using them!
If you have any questions post them in the comments and I'll do my best to answer them.
๐ Subscribe for more Unity Tutorials https://www.youtube.com/channel/UCFK6NCbuCIVzA6Yj1G_ZqCg?sub_confirmation=1
See you next time!
--------------------------------------------------------------------
Hello and Welcome!
I'm your Code Monkey and here you will learn everything about Game Development in Unity using C#.
I've been developing games for several years with 9 published games on Steam and now I'm sharing my knowledge to help you on your own game development journey.
I do Unity Tutorials on just about every topic, Unity Tutorials for Beginners and Unity Tutorials for Advanced users.
--------------------------------------------------------------------
- Website: https://unitycodemonkey.com/
- Twitter: https://twitter.com/UnityCodeMonkey
- Steam: https://store.steampowered.com/developer/EndlessLoopStudios