This page serves for errata, comments and general bashing of the official docs.unity3d.com documentation.
Please remain civil and avoid swear words and personal insults to the impersonal documentation staff. They're probably doing as good a job as they can given whatever resource limitations they may have.
Comments in example snippets
How come the comments fall off when you switch from UnityScript to other languages? Can't the code generator keep the comments preceding the line where they were in the UnityScript source?
Would it really be so expensive to write three sets of example snippets? They aren't overly verbose to begin with...
- I'm pretty sure those aren't generated, there are three separate code samples written by humans. They probably just didn't have time/forgot to copy over the comments. Ppeterson (talk) 09:30, 1 April 2013 (CEST)
The example code, when set as the sole line of a GameObject's Update, only makes it spin wildly.
Reason may be a misunderstanding apparent from the comments - or, of course, that the snippet wasn't meant to do anything relevant to begin with.
// Sets the rotation so that the transform's y-axis goes along the z-axis transform.rotation = Quaternion.FromToRotation(Vector3.up, transform.forward);
- "... so that the transform's y-axis"; Vector3.up is the global coordinate y-axis, not the Transform's y-axis.
- "goes along the z-axis" of what exactly? Transform.forward at least indeed is the Transform's z-axis.
- Make a single press button. The user clicks them and something happens immediately.