6 Code Smells REFACTORED to Patterns! @git-amend
6 Code Smells REFACTORED to Patterns!  @git-amend
Uploaded June 2024 | Updated September 2026, 5 days ago
Command, Flyweight, Factory, Builder, Strategy, and Decorator can often be implemented to solve common code smells - learn how into todays video as we refactor an Enemy Spawner from a naive implementation to a robust, modular and extensible system using game programming patterns.

NOTE: The custom `RandomPointInAnnulus` method achieves a uniform distribution within an annulus by using the square root of a uniformly distributed random value to determine the radius, ensuring an even spread of points across the area. This approach accounts for the increasing area with the square of the radius, resulting in a uniform point density. In contrast, Unity's `Random.insideUnitCircle` generates points based on a uniform distribution of radius, leading to a higher concentration of points near the center because it doesn't account for the larger area available at greater radii.

Want to support me? 😀
Buy me a coffee! ko-fi.com/adammyhre

🔔 Subscribe for more Unity Tutorials youtube.com/@git-amend

Discord: discord.gg/FDRZGQBBUC

#unity3d #gamedev #indiedev

▬ Contents of this video ▬▬▬▬▬▬▬▬▬▬

0:00 A Naive Spawning System
1:16 Flyweight
4:00 Factory
6:10 Strategy
9:05 Command
10:40 Builder
13:05 Decorator

More Useful Code:
github.com/adammyhre?tab=repositories
Unity Utility Library: github.com/adammyhre/Unity-Utils
Lock Inspector Hotkey: gist.github.com/adammyhre/4754f731a93bf1cab0d1385ccfa23642

Assets Shown In This Video (Affiliate Links)
Dungeon Mason Tiny Hero Duo: (FREE): assetstore.unity.com/packages/3d/characters/humanoids/rpg-tiny-hero-duo-pbr-polyart-225148?aid=1101lw3sv
Hierarchy Icons: assetstore.unity.com/packages/tools/utilities/better-hierarchy-272963?aid=1101lw3sv
Tiny Heroes: assetstore.unity.com/packages/3d/characters/humanoids/rpg-tiny-hero-wave-pbr-228701?aid=1101lw3sv
Fantasy Forrest: assetstore.unity.com/packages/3d/environments/fantasy/fantasy-forest-environment-34245?aid=1101lw3sv
Better Transform: assetstore.unity.com/packages/tools/utilities/better-transform-size-notes-global-local-workspace-child-parent--276554?aid=1101lw3sv
Better Mesh Filter: assetstore.unity.com/packages/tools/utilities/better-mesh-filter-266489?aid=1101lw3sv
Kyeoms VFX: assetstore.unity.com/publishers/52756?aid=1101lw3sv

*Follow me!*
https://linktr.ee/gitamend
6 Code Smells REFACTORED to Patterns!Build A Shoot Em Up Game in Unity: SIMPLE Weapon System Trick (Part 3)Mastering Custom Collision Contacts In Unity For Unique EffectsCompute Shaders in Unity, Step by StepTesting Unity’s Experimental Graph Toolkit: A Custom State MachineRevolutionize Your Unity Game with Optionals and MonadsDevOps for Game Devs: New Unity CLI + GitHub ActionsLearn to Build an Advanced Event Bus | Unity ArchitectureBuild a Rail Shooter in Unity: Generate Splines at Runtime (Part 3)5 Unity Tools I’ve Added to Reduce Friction in DevelopmentEssential Elements of Cinemachine 3.1Create Baldurs Gate Style Dice in Unity
git-amend |

6 Code Smells REFACTORED to Patterns!

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER