Unity Save Game Editor

In game development there's a lot of scratching your own itch and my latest diversion is a great example of that.  More often than I care to count, when I'm working on a new feature something gets in a weird state and I need to see what's going on with the save.  Once I figure out what happened and attempt a fix, it would be super nice to be able to then edit the save game and put it back to a correct state to test from.After thinking about it enough I decided to take the time from main game development and make this tool that should speed up future dev time. Enter the Unity Save Game Editor.…

Read more »

Hex Map Area Borders

Today we're going to learn how to create a nice border around the perimeter of an area in a hex map using Unity and a LineRenderer. Here I have it as a dotted purple line but you can make it look like anything you want with the flexibility of the line renderer!The foundation of the hex code here is adapted from the Hex Map Series by Catlike Coding which has been super helpful for getting started. So if there's any bits of code I missed here it's likely from there, but please let me know in the comments if you're getting stuck or confused anywhere. First up we'll need a little background code f…

Read more »

Minimizing string GC in Unity

Posted on

An easy trap to fall into when you're starting out in Unity is creating strings each frame in your update loop.  Say you have score that can change from a bunch of things: eliminating foes, jumping on a block, collecting a ring, or just existing. Whatever floats your boat.  Then in your score updater component you just do: void Update(){ textComponent.text = "Score: " + score.ToString(); }Easy and done.  Problem is, you're now creating a string (which are immutable in C# and allocate memory) each frame.  This will really add up and create lots of garbage which will need collecting.The U…

Read more »