How to make Unity better using Extension Methods

preview_player
Показать описание
In this tutorial we will use C# extension methods to improve our Unity experience. There are many things which are missing in the Unity API - there is a way to add those and make them feel like they are native.

Got any questions? Join our discord:

I cannot imagine this is already 5th episode of the scripting series! I hope you enjoy it!

#UnityScripting #CleanCode #CSharp
Рекомендации по теме
Комментарии
Автор

Very well explained, thank you so much :)!

christinaVennegerts
Автор

One of the things that can be confusing for beginner C# programmers is identifying a method is implemented as an extension method as well as navigating to the implementation (VS makes this easier only if you know how). One of the things I like to do is put all of my extension methods in a directory (and matching namespace) called "Extensions".

MattRaffel
Автор

Is there any was to make a variable extension? For example, instead of having a method to get the negative value of an integer, just make it into a variable? I tried it myself but you can't use `this` outside a function / not appropriately.

VLTNO
Автор

Are you working on any games? Where did you learn your skills? they are very good for being game-specific skills.

Renegen
Автор

Personally I avoid extension methods, because they look like methods that are part of a class but aren't. In a future project I'd be wondering why Vector3 doesn't have method X anymore, when it never did and I played myself.

newarteest
welcome to shbcf.ru