Suppose you have a Horizontal Layout Group in a Canvas-based UI in Unity, and some elements in the group should expand but not others. Or some should expand at different rates than others. Checking the Width option of Child Force Expand on the group seems like it might do what you want, but you are […]

A student and I were collaborating on a poster. We needed an image of a Unity scene that for a 4-foot-by-4-foot poster. Capturing our screens at their normal resolutions resulted in images that got fuzzy when scaled. So, we worked up a quick method for taking screenshots at higher resolutions with a render texture. Perhaps […]

Unity’s RectTransform can be used to achieve a couple of common multi-column UI patterns. I describe here how to achieve these using only anchors, offsets, and pivots—and not any layout groups. Percentage-based N-column Layout If your layout requires multiple columns and each column is apportioned a percentage of the total display, set each column’s X […]

Unity’s RectTransform layout system has confused me for a very long time. Not that there’s anything wrong with it. Confusion is what naturally happens when you approach a sophisticated system and just start pressing buttons. But in order to move past this stage, I’m documenting what I’ve learned after many hours of pressing. Properties Each […]

In this class I ask you to host your games on GitHub. This will allow you to share files and minimize damage when something breaks in your project. Follow the setup instructions below to create a remote repository on GitHub and tie it to your local Unity project. Remote Repository on GitHub We first need […]

I often model things like walls and leaves with only one side. Most computer graphics tools I’ve dealt with only show geometry that faces the viewer. This puts one-sided surfaces in a predicament. When the viewer goes behind them, the geometry disappears. One simple workaround to this problem is to duplicate your one-sided model and […]

Problem: I have a game object, a prefab probably, that I instantiate and velocify. It goes off screen. I want it gone then. Solution: To expire a game object or component based merely on time, call Destroy(thingToDestroy, nSeconds). After nSeconds elapses, thingToDestroy will disappear.

Problem: I want, in the Unity game engine, to shoot projectiles at text and decrement the number the text is displaying. Solution: Add a 3-D text game object. Add colliders to projectiles and the text. The collider on the 3-D text will automatically size itself around the bounds of the text. Implement OnTriggerEnter and update […]