StrangeIoC is a library that can help you build your Unity app with a “pure code” approach. Today’s article addresses one common concern with using StrangeIoC- it uses a lot of reflection. As we know, that’s really slow in Unity. StrangeIoC tries to work around it by letting you control when the reflection takes place so you can put it on a loading screen or some other convenient place. Today’s article finds out just how slow the reflection is to determine if this is really a valid reason to not use StrangeIoC (or other dependency injection frameworks). Read on to find out!
Contrary to what you may have learned in a data structures class, linked lists are virtually always slower than just using arrays. The same goes for array wrapper classes like
List. Today’s article discusses why this is the case and tests it out with a C# Unity app to make sure that the real world validates the theory.
System.Collections.List<T> is used everywhere in C# code. Except for very special cases, it’s the replacement for arrays, linked lists, queues, and most other one-dimensional data structures. This is because it has all kinds of extra functionality, including the ability to grow in size on-demand. Today’s article wonders about how much performance is lost to gain this convenience and tests the
List<T> class against the lowly C# array:
T. How much performance are you giving up with
List and why is that happening? Read on to find out!
Today’s article guides you through the necessary steps to create, use, and debug a .NET DLL in Unity. These can help you modularize your code into libraries that can be imported as a single file by the users of your library. They’re especially useful when utilizing the “pure code” approach to code design as you can easily break up a Unity app’s monolithic structure into reusable components. So read on to learn how to use DLLs in Unity!
One type of function was left out of Unity Function Performance: virtual functions. Functions in C# are non-virtual by default and you have to explicitly use the
override keywords to override them. Why not make this the default, like in AS3 or Java? Are virtual functions that much slower? Today’s article finds out! Should you be worried every time you make a function
How fast are C# delegates and events? The best answer is “compared to what?”. You probably use callbacks all the time, but what’s the fastest kind of callback? C# delegates and events are nice, built-in features of C#, but you could also implement your own callback interface. Would that gain you any speed? Read on for the performance test and results!
As you use iterator functions (and
yield) more and more, you’ll start to run into some limitations in the C# language. For instance, you can’t
yield inside a
try block that has a
catch block. And the
foreach loop doesn’t provide a very good way to catch exceptions when looping over an iterator function, either. Today’s article goes into detail to find solutions to these issues and make iterator functions usable in even the trickiest scenarios!
C# supports iterator functions with the
yield keyword. Unity uses them to support coroutines. Unfortunately, both are poorly understood by many Unity programmers. Today’s article dives into iterator functions and coroutines to better understand how they work and what they can be used for. Read on to learn how to use iterator functions and coroutines for more effective asynchronous code!
Today’s article shows a class that helps clean up your
foreach loops when you want to call
Remove() on the
List you’re looping over. Normally you’d get an exception, but today’s class works around that problem so your code is less error-prone and easier to read. It also discusses some workarounds you can use even if you don’t use
SafeList. Read on to learn how to make your
foreach loops less error-prone! UPDATE: SafeList 2.0 is out!