Game Development Reference
In-Depth Information
Figure 5-1. Importing a First Person Controller (from the Character Controller package) into the Unity project
Note This chapter assumes you're resuming work from where we left off in the previous chapter, or else
you can begin from the starting project associated with this chapter, included in the topic companion files
inside folder Chapter04/Start .
After the Character Controller package is fully imported, you can easily add first-person functionality
to your game, simply by dragging and dropping the First Person Controller from the Project panel
into the scene. The First Person Controller is really a Prefab object. Adding this will typically override
any existing cameras in the scene, replacing them as the default scene camera. When running
the game with a First Person Controller, you may receive a printed error or warning in the console,
complaining about multiple audio listeners. The error usually reads: “There are 2 audio listeners in
the scene. Please ensure there is always exactly one audio listener in the scene,” (see Figure 5-2 ).
This normally happens when two or more cameras, each with an AudioListener component, are
active in the scene simultaneously. This causes sound/audio conflict because each AudioListener
represents a separate ear point or location from which sound is heard. To solve the problem, you
can delete any unnecessary cameras (always delete unnecessary objects!), or you can remove the
AudioListener component, or you can deactivate the AudioListener (if it'll be needed at a later time).
The key point is: there should be no more than one AudioListener component active in the current
scene at any one time.
 
Search WWH ::




Custom Search