- Home /
Drag and drop an Audio Listener (Editor)
Hi guys,
Can you drag and drop an AudioListener into a List or Behaviour[] (array) ? Before updating my unity version to 5.3, it worked well..!
Aha!
$$anonymous$$ade a quick workaround (I'm taking you used the Brackeys tutorials?
Just use this script and drag the whole Camera GameObject into the ListenerToDisable array and then add the camera and other behaviours into the other array
using UnityEngine;
using UnityEngine.Networking;
using System;
public class PlayerSetup : NetworkBehaviour
{
[SerializeField]
Behaviour[] componentsToDisable;
[SerializeField]
AudioListener[] listenerToDisable;
Camera sceneCamera;
void Start()
{
// Disable components that should only be
// active on the player that we control
if (!isLocalPlayer)
{
for (int i = 0; i < componentsToDisable.Length; i++)
{
componentsToDisable[i].enabled = false;
}
for (int i = 0; i < listenerToDisable.Length; i++)
{
listenerToDisable[i].enabled = false;
}
}
else
{
// We are the local player: Disable the scene camera
sceneCamera = Camera.main;
if (sceneCamera != null)
{
sceneCamera.gameObject.SetActive(false);
}
}
}
// When we are destroyed
void OnDisable()
{
// Re-enable the scene camera
if (sceneCamera != null)
{
sceneCamera.gameObject.SetActive(true);
}
}
}
Answer by exowatt · Dec 15, 2015 at 10:33 AM
No i don't use the Brackeys's tutorial. But i found a solution alone : Right Click on "Inspector" tab and enter in Debug Mode, you could drag and drop after that.
HI exowatt, can you please explain the process of it. I mean why we can only drag it when we set debug mode??
Detailed explanation is appreciated.
This didn't work for me. I cannot drag the audio listener from one inspector to another, regardless of the normal/debug mode of either panel. Any other suggestions?
Answer by wasSSsim · Jan 01, 2021 at 09:44 PM
i was Following Brackeys tutorial too and i found a way to do it just add it to the player object not to the prefab and than go up in the inspector and in the overrides dropdown panel click "Apply all"
Answer by WOODSY · Dec 15, 2015 at 08:41 AM
I can't either, probably because there is no way to disable it with a boolean
You have to set debug mode of the inspector panel from which you are dragging the component, not of the inspector panel in which you are assigning it.
Try as mentioned and if it still didn't work then please try to explain it in brief.