If you’ve been using Unity’s Canvas-based UI system to create a main menu, pause screen or even a death screen for a game in Unity, you may sometimes encounter an issue where some buttons on your UI don’t seem to be responding when you hover over or click on them.
Continue readingAbout the author:
Terence
A geek of the highest order, Terence speaks a great number of (programming) languages and dabbles in a couple of tech fields. He writes about common problems programmers come across in this blog.
All posts by Terence:
What is a kinematic rigid body and how are they used in Unity?
If you’ve ever used a Rigidbody component in Unity, you may have seen a couple of settings on the component which may be a little difficult to understand the meaning of. On this site, we have covered what some of these settings mean and what they do, such as:
- The Collision Detection property, which controls what kind of collision detection mode your Rigidbody is using. This is because using the wrong Collision Detection mode can cause tunnelling.
- The Interpolate property, which controls how a Rigidbody’s position updates, and prevents things like camera jitter when used properly.
How to code a moving platform for your 2D platformer in Unity
One of the most common questions I get from students looking to build a platformer is this: how do I build a moving platform in Unity? Well, if you are looking for code that you can just copy-paste into your project, look no further.
Continue readingTry it yourself: Compare the performance of Java’s String vs. StringBuilder vs. StringBuffer
If you are dynamically generating strings in your Java program, one of the best things you can do for your program is to build your string using a StringBuilder
or StringBuffer
, as opposed to using a regular old String
.
The reason for this? In Java, strings are immutable, and every time you concatenate a string that the program hasn’t seen before, a new string object is created and stored in the heap. This means the whole process involves a lot of reading from and writing to the memory. The StringBuilder
and StringBuffer
in Java are objects that are designed to do string concatenation in a more efficient manner, but how much more?
We’ve got a simple Java program here that you can run from your browser so you can see it for yourself.
Continue readingHow I made double dashes automatically convert to em dashes in WordPress Gutenberg Editor
Over the weekend, I was tackling a client request requesting for us to help modify their WordPress backend so that when writing posts, the Gutenberg Editor will automatically convert consecutive double dashes --
to an em dash —
character.
It was a particularly difficult task for me, despite having coding in WordPress for many years, simply because the Gutenberg editor was relatively new, and there is very little documentation regarding it.
Continue reading