[英]Playing audio from array - Unity
Im currently getting this error "Cannot implicitly convert Type JsonData.Message[] to Unity engine.audioclip": on this line of code:我目前收到此错误“无法将 Type JsonData.Message[] 隐式转换为 Unity engine.audioclip”:在这行代码中:
source.clip = content.queryResult.fulfillmentMessages;
JsonData.Message: JsonData.Message:
[Serializable]
public class Message
{
public SimpleResponses simpleResponses;
}
Other Classes其他类
[Serializable]
public class SimpleResponses{
public SimpleResponse[] simpleResponses;
}
[Serializable]
public class SimpleResponse{
public string text_to_speech;
public string ssml;
public string displayText;
}
What is the best way to play the data that's stored in the array?播放存储在数组中的数据的最佳方式是什么?
i suppose its an array od audio so try for example:我想它是一个数组 od 音频所以尝试例如:
source.clip = content.queryResult.fulfillmentMessages[0] as UnityEngine.AudioClip;
to be sure content.queryResult.fulfillmentMessages.Length > 0
确保content.queryResult.fulfillmentMessages.Length > 0
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.