Enums are one of C#’s basic data types and represent a set of named integer constants, e.g. attack types or player states. public enum PlayerStates { None, IsDead, IsJumping, IsGood, HasCompletedTheGame, HasAllAchievments, } The unity inspector supports enums out of the box, so the previous enum would look like this. We can select exactly one…
Posts Tagged
code snippet
Tip of the Week #3: Decompiling Unity with dnSpy
For a side project of mine, I recently needed access to the implementations of some Unity Types like UnityEditor.MaterialEditor. Unity is not an open source platform and trying to understand its internal workings can be hard. Thankfully you can decompile Unity’s DLLs to get an insight of what is happening in the engine. My favorite…
Logging in Unreal made simple with helper macros
Logging is one of the most useful things one can do while developing a complex piece of software such as a video game. When it comes to c++ and unreal there’s a small collection of macros I use to make tracing simpler and more informative. These logging helpers give you access to information about current class, function…
Serialization – Saving Objects as Files
Unity’s often used built in form of serialization are the PlayerPrefs. As Lars Kokemohr, the Head of Programming at the School4Games, points out in this Facebook post: The are a lot of drawbacks to saving data using Unity’s PlayerPrefs class. Furthermore he advises that A cleaner way of doing it would be to create a…