Game Development Reference
In-Depth Information
Figure 14.2 shows the script we built to open doors with a bit of extra
functionality; note that UniSciTE color codes things like comments. A habit I
like to establish is to include the comments on the line that the comment is
referring to and tab them all over so they are easy to see and read.
Even though a script might make perfect sense as you are writing it, you will
be amazed at how long it takes to get back into the mode of thinking you
were in when you wrote the script several days later when you're deep in the
script again bug squashing.
And if you're working as part of a team, good grief, comment the script. It will
keep teammates happy.
Lastly, if there is one line that needs to be temporarily disabled, putting // in
front of that line of code will cause it to be ignored by Unity at runtime.
Commenting Blocks of Script with /*
Perhaps there are scripters who write perfect code on the first pass. I'm not
one of them, and frequently what I think is going to work simply doesn't. The
problem is that sometimes I'm uncertain if it's just a syntax problem I've got,
or my whole approach is flawed. On occasion this means that I need to try
Search WWH ::




Custom Search