未找到专用AudioController所需的命名空间

时间:2015-07-27 09:10:50

标签: unity3d

我在代码中包含了以下行,但AudioController突出显示为红色,因此我搜索了相应的命名空间,但似乎UnityEngine就足够了。

我还应该包括哪些才能使用它?

private AudioController audioController;

以下是完整的相关代码:

using UnityEngine;
using UnityEngine.UI;
using System;
using System.Collections;

public class MenuScript : MonoBehaviour
{
    private AudioController audioController;

    void Awake()
    {
        DontDestroyOnLoad( this.gameObject );
    }

    void Start()
    {
        audioController = GameObject.FindWithTag("AudioController").GetComponent<AudioController> ();
    }

    public void LoadLevel( string sceneName )
    {
        audioController.PlayMenuClick();
        StartCoroutine( LoadSceneAsync( sceneName ) );
    }

    private IEnumerator LoadSceneAsync( string levelName )
    { 
        yield return new WaitForSeconds( 0.2f );
        Application.LoadLevel( levelName );
    }

    public void startSimulation()
    {
            LoadLevel( "mainScene" );
    }
}

0 个答案:

没有答案