I have it set so that the player can change between two cameras (first person perspective and third person perspective) by hitting a keybind. So, I have two cameras in my scene. I get a notification in the console that says:
“There are 2 audio listeners in the scene. Please ensure there is always exactly one audio listener in the scene.”
In order to combat this, I tried the following code in the Start () method of the CameraControllerScript, which belongs to an empty called CameraController. The CameraController is the parent object of both cameras, and I attached their scripts to that Controller.
Code:
public class CameraControllerScript : MonoBehaviour {
bool isFPSCameraActive = false;
bool isThirdPersonCameraActive = true;
FirstPersonCameraScript fpsCamera;
ThirdPersonCameraScript thirdPersonCamera;
void Start () {
fpsCamera = gameObject.GetComponent<FirstPersonCameraScript>();
thirdPersonCamera = gameObject.GetComponent<ThirdPersonCameraScript>();
isFPSCameraActive = false;
fpsCamera.enabled = false;
isThirdPersonCameraActive = true;
thirdPersonCamera.enabled = true;
(The bools are used later in the code)
I figured this would work, seeing as the above code means that when I hit the play button, the fpsCamera is turned off and the thirdPersonCamera turned on. However, I’m still getting that same 2 audio listeners in the scene issue.
Am I overlooking something? Sorry for yet another question by me, I’m still learning. This is a huge important part of my game, so learning how to fix this would be VERY beneficial ![]()