Quantcast
Channel: Questions in topic: "error message"
Viewing all articles
Browse latest Browse all 2891

I'm getting an error: "AudioClip can't be deserialized because it has no default constructor"

$
0
0
I'm trying to add voice chat functionality to my multiplayer game. I'm using Mirror for the multiplayer. Unity is returning "AudioClip can't be deserialized because it has no default constructor", and "Weaving failed for: Library/ScriptAssemblies/Assembly-CSharp.dll" Any suggestions would help, I don't understand what's causing the issue. Here's my code: using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine; using Mirror; public class VoiceChatManagerScript : NetworkBehaviour { public string micName; [SyncVar(hook = nameof(PlayVoices))] List currentVoices = new List(); [SyncVar] float timer = 0; Voice voice; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { } void PlayVoices(List oldVoices, List voices) { if (Microphone.devices.Contains(micName)) { Microphone.End(micName); CmdSendCurrentVoice(voice); foreach (Voice v in voices) { AudioSource.PlayClipAtPoint(v.clip, v.position, 1f); } voice = new Voice(); voice.position = GameObject.FindGameObjectWithTag("localPlayer").transform.position; voice.clip = Microphone.Start(micName, false, 1, 44100); } else { foreach (Voice voice in voices) { AudioSource.PlayClipAtPoint(voice.clip, voice.position, 1f); } Debug.Log("Unknown mic name specified, please enter the correct name."); Debug.Log(Microphone.devices); } } [Command(ignoreAuthority = true)] void CmdSendCurrentVoice(Voice currentVoice) { currentVoices.Add(currentVoice); } } public class Voice { public AudioClip clip; public Vector3 position = Vector3.zero; public Voice() { } }

Viewing all articles
Browse latest Browse all 2891

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>