convert type UnityEngine.Object to UnityEngine.AudioClip

Hi guys! I’m trying to make a OpenFilePanel like this one but I want to open a ogg file. I’m also writing in C#.

I have this:

AudioClip audio = Selection.activeObject;
		
		if(audio == null){
			EditorUtility.DisplayDialog("Select a music", "You must select a music first!", "Ok");
			return;
		}
		
		string path = EditorUtility.OpenFilePanel("Teste", "", "ogg");
		
		if(path.Length != 0){
			WWW www = new WWW("file:///" + path);
			
		}

I’m having this error: error CS0266: Cannot implicitly convert type ‘UnityEngine.Object’ to ‘UnityEngine.AudioClip’. An explicit conversion exists (are you missing a cast?)

I tried somethings but got nothing. How can I make it? Thank you :slight_smile:

As the error says, you forgot to cast:

AudioClip audio = Selection.activeObject as AudioClip;