UTF-8
Errata: October 12, 2022Chapter 1, Section 1.3.1, page 17
In the NOTE, the line:
the code is executed within the Unity game engine, as opposed to compiled code that runs as its own executable.
should only be:
the code is executed within the Unity game engine.
The original statement was from the first edition, before Unity introduced the whole LLVM approach.
Chapter 6, Section 6.4.3, page 139
The code listing detects ground beneath the player, and then limit jumping based on that. However the code in the book has a subtle bug, where jumps go too high when the player is standing up against the block wall. This happens because it's checking a bit too wide, and detecting surfaces to the side instead of only below. Specifically, the problem is in this bit of code:
Vector3 max = box.bounds.max;
Vector3 min = box.bounds.min;
Vector2 corner1 = new Vector2(max.x, min.y - .1f);
Vector2 corner2 = new Vector2(min.x, min.y - .2f);
Replace that with the following:
float minY = box.bounds.min.y;
float spanX = box.bounds.extents.x - .01f;
float centerX = box.bounds.center.x;
Vector2 corner1 = new Vector2(centerX - spanX, minY - .1f);
Vector2 corner2 = new Vector2(centerX + spanX, minY - .2f);
Chapter 10, Section 10.2.3, page 244
The text mentions a documentation section called "Installation via Pure UPM". However, the documentation for this library has changed, and now the relevant section is called "Installing the official UPM package". Indeed, the way to get this JSON library has changed considerably, but the WARNING in the book correctly anticipated the change.
Chapter 12, Listing 12.7, page 290
The description after the listing mentions OnMouseDown, but the listing actually uses OnMouseUp as the method name. This code has been changed from previous editions but I forgot to update the description as well.