Game Development Reference
In-Depth Information
object. Using them this way does not affect the performance and can save you hours of
searching for the reason for a crash because you forgot to add something.
However, as stated before, do not use Debug.Log extensively or in the normal operation
of your game. This is because it kills the performance!
Another approach is to write your own utility function to perform logging, which can be
controlled by a single flag. So, instead of Debug.Log , you will call DebugUtil-
ity.Log or DebugUtility.LogWarning , which will then call Debug.Log if it
was enabled. This allows you to place the logging code throughout your project and have
a single place where you can turn it all on or off.
Nice tip from our reviewer, Fredrik Kellerman!
Updating the Goblin prefab
The Goblin prefab we created earlier now needs this new EnemyController class at-
tached to it. Select the Goblin prefab from Assets\Prefabs\Characters , click on
the Add Component button in the Inspector window, and navigate to Scripts |
EnemyController , as shown in the following screenshot:
Search WWH ::




Custom Search