Uploaded March 2026 | Updated September 2026, 2 weeks ago
In this video I share a few C# tricks that help keep your Unity code shorter and cleaner.
We cover the out variable pattern using Physics.Raycast, TryGetValue for dictionary lookups, and TryGetComponent for accessing components — all avoiding unnecessary variable declarations. We also look at the is/or pattern matching syntax as a cleaner alternative to long equality checks.
These are small but practical improvements that add up when writing a lot of gameplay code.
····· Get in touch ···············································································
𝗛𝗮𝘃𝗲 𝗮𝗻𝘆 𝗾𝘂𝗲𝘀𝘁𝗶𝗼𝗻𝘀? 𝗝𝗼𝗶𝗻 𝘁𝗵𝗲 𝗱𝗶𝘀𝗰𝗼𝗿𝗱!
discord.gg/RQEtYHz
𝗣𝗟𝗘𝗔𝗦𝗘 support the channel:
patreon.com/sunnyvalleystudio
In this video I share a few C# tricks that help keep your Unity code shorter and cleaner.
We cover the out variable pattern using Physics.Raycast, TryGetValue for dictionary lookups, and TryGetComponent for accessing components — all avoiding unnecessary variable declarations. We also look at the is/or pattern matching syntax as a cleaner alternative to long equality checks.
These are small but practical improvements that add up when writing a lot of gameplay code.
····· Get in touch ···············································································
𝗛𝗮𝘃𝗲 𝗮𝗻𝘆 𝗾𝘂𝗲𝘀𝘁𝗶𝗼𝗻𝘀? 𝗝𝗼𝗶𝗻 𝘁𝗵𝗲 𝗱𝗶𝘀𝗰𝗼𝗿𝗱!
discord.gg/RQEtYHz
𝗣𝗟𝗘𝗔𝗦𝗘 support the channel:
patreon.com/sunnyvalleystudio










