0%

I have to say that Unity is a good game engine, but not the best! Unity offers all basic functionality that you need, but if you want to achive you requirement, you must do many extra works. From this perspective, Unity is a bit like C programming language.

2D Map

One month ago, I wrote a tilemap generator. I was going to generate some basic 2D maps by this tool. But recently I realised that I shouldn’t use a MonoBehaviour to generate 2D maps because the generation of terrain should be done by brushes, and that sounds more rational. So how to do that? The answer is Scriptable Brushes. So I created a couple of brushes to do that, and of course, using brushes to generate maps is more flexible than using a MonoBehaviour because you can paint or erase specific areas.

ChunkBrush

2D Frame Animation

So the next problem is Frame Animation. Just like the walking animation, 2D artists usually paint all frames releated to the walking animation into a sprite sheet. For example, in the sprite sheet below, it contains many animations releated to different skin color, and the number of sprites is 3135!

A example sprite sheet

The problem is, should I drag sprites from the sprite sheet and create animation clips one by one? That’s incredible! This means I have to perform the same operation - dragging - at least 3135 times. In fact, one asset package usually contains dozens of such sprite sheets to support character customization. This means you also have to create a basic animator controller and thousands of override controller of the basic controller! So I wrote severals script to do that and finally I got almost 2500 controllers in a few minutes. Without that, it could have taken me months to create these controllers. The below script snippet may be useful to you, which could save you tons of time in the process of creating thousands of controllers. Btw, try-catch is not necessary but is recommended.

1
2
3
4
5
6
7
8
9
10
11
12
13
try {
AssetDatabase.StartAssetEditing();
for (int i=0; i<frameAnimations.Count; i++) {
AnimationDetail detail = frameAnimations[i];
AnimationClip clip = CreateAnimationClip(detail);
AssetDatabase.CreateAsset(clip, $"{rootPath}/{detail.animName}.anim");
}
}
finally {
//AssetDatabase.SaveAssets();
AssetDatabase.StopAssetEditing();
//AssetDatabase.Refresh();
}

Selecting multiple sprites in the Sprite Editor

Feature request: selecting multiple sprites in the sprite editor

The Sprite Editor doesn’t support multiple selections! That’s unbelivable! I’d like to ask the Unity development team, What are you doing every day? There are many such feature requests in Unity forum, but after so many years, the Sprite Editor still doestn’t support that operation! And the offical document doesn’t give you any useful information. So I have to read the source code of the Sprite Editor. Finally I made an extension module of the Sprite Editor. Actually, if the Unity development team provides enough information in the documentation, it is not difficult to make an extension module for the Sprite Editor, and I think that ISpriteEditorDataProvider already provides everything for creating an Sprite Editor.

TileSetEditor

Making Rule Tiles

I wrote a Rule Tile maker to make rule tiles based on the QuickRuleTileEditor, but making rule tiles should be done in the Sprite Editor, isn’t it? After making TileSetEditor, I realised that making a rule tile editor is very easy! Just remove some code from TileSetEditor.

RuleTileEditor

There was no apology and this video is even fake, so farewell, Messi.

But I’m still a big fan of Argentina. For Garnacho, and for Lautaro.

And CR7, to me, you’ve always been the only GOAT.

I wrote my first line of C++ code about fifteen years ago. Yeah, the first programming language I learned was C++. I learned C++ from a book on data structure and algorithms, which was also a university textbook, but now I don’t think it’s a good book, lol. And I also bought a book written by the father of C++, The C++ Programming Language, but I couldn’t understand the book. The book was too difficult for me, especially later chapters on how to design classes. But then I wrote a OGRE’s 3D editor in C++ and MFC. Of course, I referenced other people’s code. I also mainly use C++ in competitive programming.

Today, there is much more news on problems and emergencies than on positive developments in the media. For example, there is a famouse TV channel called CCTV4 in China. Every day there are some news reports on this channel. But when you switch on the TV, switch to CCTV4 and prepare to relax, all you see is always bad news!

I can’t believe I didn’t know about Stoicism until 2023. More precisely, I can’t believe I didn’t know about philosophy until 2023. So, what is Stoicism?

Hello, everyone. You may find that my blog is based on the github. So how I built my blog? All right, I’ll make it simple. I hope you could also build a blog based on the github after reading this blog.

Well, you may have realised that I’m a Chinese. So why do I use English instead of Chinese?
Yes, Chinese, or more accurately, Mandarin, is my first language, and I’ve been learning chinese since I was a baby, about two or three years old. But a fact is that most chinese people no longer enjoy reading articles written by chinese people after leaving schools.

《加密与解密》is a book written by a couple of master at kanxue.com that tells you about techniques in the software reverse engineering. I bought this book a few years ago, but I couldn’t understand the content at the time. After a few years on the shelf, I sold it two years ago. But recently I read this book again because I wanted to decrypt a piece of software.

OK. I only want to talk about Chapter 20, 《虚拟机的设计》. It’s “how to design a virtual machine” in english. To be precise, it teaches you how to design a virtual machine software, like the well known VMProtect, to protect your software. This chapter is not easy to understand because the author omitted many details. So, I’d like to write some notes down.