以编程方式销毁或禁用Audio Listener?

时间:2018-01-22 19:07:44

标签: unity3d

我有以下静态相机:

public Camera standbyCamera;
standbyCamera = GameObject.Find("StandByCamera").GetComponent<Camera>();

如何通过代码禁用或销毁关联的音频侦听器?

我尝试了以下内容,以及一些变体,但没有任何作用。

如何禁用与相机关联的音频侦听器?

From the Unity forums

standbyCamera.GetComponent (AudioListener).enabled = false;
  

错误CS0117:&#39; UnityEngine.Component&#39;不包含&#39;已启用&#39;

的定义
Destroy (standbyCamera.GetComponent (AudioListener));
  

119:表达式表示type', where a变量&#39;,value' or方法组&#39;预计

1 个答案:

答案 0 :(得分:4)

你会想做:

Destroy(standbyCamera.GetComponent<AudioListener>());

看起来您也可以https://www.postgresql.org/docs/9.1/static/libpq-example.html

如果这还不够,你可以尝试使用audiolistener制作一个子对象并启用/禁用该子对象。