Archive for June, 2015

A Model-View-Controller (MVC) Pattern for Unity

Tags: , , , , ,

What do you do if you want to use the Model-View-Controller (MVC) design pattern in your Unity app but you don’t want to use a framework like StrangeIoC? With a little thinking about the problem I think I’ve come up with a simple yet effective pattern to follow that doesn’t require you to use any framework. In today’s article I’ll talk about each part, how the parts fit together, and how you can use MVC to cleanly organize your “pure code” app. Whether you’re an MVC newbie or just want to see a new take on MVC in Unity, you’re sure to learn something today!

Read the rest of this article »

180 Comments

StrangeIoC Reflection Performance

Tags: , ,

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!

Read the rest of this article »

No Comments

Linked Lists Are Slow

Tags: , , ,

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.

Read the rest of this article »

7 Comments

Optimizing Arrays and Lists

Tags: , , , ,

Last week’s article compared the performance of arrays with List<T> and found List lacking. This week we’ll optimize both List and array to maximize performance regardless of which you choose to use.

Read the rest of this article »

6 Comments

Array vs. List Performance

Tags: , ,

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!

Read the rest of this article »

22 Comments