Most important shortcuts in Visual Studio / VS Code
This is how I have my shortcuts set up, in both Visual Studio (VS) and Visual Studio Code (VS Code). The setup will require some tweaking to get the same results in both editors.
Suggestions for improving ReorderableList element in the UnityEditorInternal
I have recently started using ReorderableList element. I've had to implement some kind of 'list of lists' and would like to share my ideas about improvements.
Unity C# Performance Comparison: 'is' vs Enum vs Virtual Call
Recently I've had to implement a very high performance component that required treating elements of an array differently based on their type. All the elements were put into a generic list of base types, and the method operating on the elements had to behave completely differently based on the exact type. Generally, this is a typical example where polymorphic behavior should be considered, the subclasses could override a base method and do the operation themselves. This was not an option in my case for certain architectural reasons.
Design Patterns Revisit in modern C#
This article has been inspired by a recent show on Channel 9, which presents design patterns. While these have been around for a long time and certainly have had great influence on how we write code, the implementation can actually get more lightweight in modern programming languages such as C# and recent Java.
NUnit 2 Cheat Sheet for Unity developers
Unity 5.5 ships with NUnit 2.6. It is accessible through the Window menu, Editor Test Runner. The documentation on NUnit 2 is good, but admittedly isn't very accessible. I will provide my collection of most important attributes and assertions, also with my comments (taken at the time of Unity 5.5 release), saving you the trouble of having to click through the whole documentation. My comments are shown in italic.
Ring Buffer Data Structure + Source Code
RingBuffer is one of those simple, useful data structures that you don't get in the .NET Framework (or not quite the way we want it) and can be useful in certain situations within game development when we want to pack the data tightly.
AI architecture proposition (DEAT)
There are quite a few well known techniques in the modern world of AI for games. There are decision tress, finite state machines, hierarchical finite state machines, behavior trees, 2nd generation and event-driven behavior trees, goal oriented behaviors, goal oriented action planning, hierarchical task networks to name the most prominent ones in order of complexity. The decision which one to use comes down to weighting complexity vs. benefit, and the availability of libraries for some developers. I have been researching the topic recently and have decided to make my own AI model for fun and practice. It is not meant to be the best, most perfect thing ever, it is one solution to the problem. The major benefit is simplicity and speed in all aspects. What is it and how to do it? Read on!
VS Code Syntax Coloration for Unity
Since Unity Technologies is now closely collaborating with Microsoft, it's relatively easy to set up Visual Studio Code editor to work with Unity Engine. You do get Intellisense and advanced debugging capabilities, but you don't get syntax coloration properly like in full Visual Studio. The highlighter in VS Code is not context aware, it does not have semantic highlighting. The highlighting is based on regular expressions, upon which a chosen textMate theme is applied. This means your own types, Unity types, all fields and method calls will simply be white. It also seems roslyn (OSS compiler) already has the required API capability to implement this and it is a matter of time when Code will get it. Well, it's been about a year and we still didn't get it... Even the prettyprint
on my site that you can see below has better syntax recognition!
Hg setting up pre-hook to not allow commits when there are unknown files
By default Hg will not warn you about the files created, but not yet added. This can result in a situation where you have created a commit, but that commit does not include newly created files. Everything seems fine, but the push is incomplete.... and you transfer to a new machine and you're missing files, or your colleagues are confused. This happened to me a couple of times, so I looked for ways to avoid it in the future. Admittedly, it's not hard to check for status every time before a commit, but you can still forget it sometimes. I usually dealt with this with an com --amend
option after realizing I forgot to hg add
, but there is a saying "if something bothers you more then 3 times within a week, make sure to fix it." So, here's how.
Intermediate Advanced Mercurial tips: Game Development perspective
Mercurial (Hg) is a powerful and sleek distributed version control system. It's quick and gives you the ability to do anything you'd ever want with source control. I have yet to come across a feature from the competing DVCS that you cannot do in Hg, and easier and quicker. It is an extendible platform; because it provides a base command set while more advanced commands have to be explicitly enabled. It is made to be user friendly, and makes sure you know what you're doing. Some user-made extensions can even be downloaded online and can become a part of your standard workflow. With that said, which extensions to choose and where to use them becomes a user's preference. Over the years, it seems Hg has integrated a large part of best extensions into the core distribution and all you have to do is enable them. The installation of other extensions is really simple; you just place a Python file somewhere and point to it in a config file.