Skip to content

Extensions

Andrew Rumak edited this page Sep 15, 2023 · 7 revisions

There are lots of them πŸ˜…

I will fill this page someday...

In the meantime, you can enable Intellisense to display self-documentation of these methods by following these steps: In Unity Editor, open Edit > Preferences > External Tools and enable "Generate .csproj files for" Registry packages and Git packages, then click "Regenerate project files". The next time you open Visual Studio, Intellisense will show you comments for MyBox's extension methods.

MyAlgorithms

T Cast(this IConvertible source) – Convert source object to a different type

bool Is(this object source) – Check if the object is a particular type

T As(this object source) – Cast object to a different type, exception safe

T Pipe(this T argument, Action action) – Take an object and pass it as an argument to a function

TResult Pipe<T, TResult>(this T argument, Func<T, TResult> function) – Take an object and pass it as an argument to a function

T PipeKeep<T, TResult>(this T argument, Func<T, TResult> function) – Take an object, pass it as an argument to a function, return the object

UnityEvent Once(this UnityEvent source, UnityAction action) – Adds a listener that executes only once to the UnityEvent

Also for different UnityEvents with up to 4 arguments (UnityEvent<T0, T1, T2, T3>)


Clone this wiki locally