So recently I had to implement a barcode generator in Unity. What I needed was:
- The ability to generate different types of barcodes (QR, Code 128, PDF 417 etc…)
- Get a Texture2D / Sprite from a piece of data that needed to be encoded.
- To do it efficiently and consistently
A few google searches later I found that the vastly popular ZXIng library has a .NET port, which offers a Unity optimized DLL, so I decided to try it out.
Continue reading “Generating barcodes in Unity with ZXIng”
NOTE: You should probably use ScriptableObjects instead.
The ringleton is a design pattern I’ve been (ab)using quite a lot recently. It’s a really handy way of serializing / deserializing data that is used across your game.
Basically, what I needed was a quick and simple way of storing some data which is then used on multiple locations in my game. In bigger games you would probably use some form of custom json serializatian but that seemed a bit much for my needs.
This is what I came up with.
Continue reading “RIngleton – a resource Singleton!”
Most of the time, Unity is great, but sometimes, you have to get your hands dirty. And this is the case with texture loading. Sure, it works great, if you’re using the built-in system, but that’s not possible in some cases.
Imagine this scenario: You’re making a 2D game, that has, say, 15 levels, and each level has a background. Since you’re making your game for mobile devices you want to keep your game as compact as possible. 10 levels in you’re pretty happy with yourself, the install file is roughly 20mb and that seems reasonable. But you notice that once you install your game on an iPad it suddenly becomes 600mb and that just won’t work.
So what’s going on here?
Continue reading “Asynchronous texture loading in Unity”