ArgumentNullException: Value cannot be null
Posted: Sun Apr 12, 2020 9:56 pm
Hi i am having an issue playing audio back from my server. It used to work previously but returning to my project some months later I am receiving the following error:
ArgumentNullException: Value cannot be null.
Parameter name: _unity_self
code below, Any help much appreciated.
Error highlighted in the code near the bottom.
ArgumentNullException: Value cannot be null.
Parameter name: _unity_self
code below, Any help much appreciated.
Error highlighted in the code near the bottom.
Code: Select all
public class PlayThoughts : MonoBehaviour {
public AudioSource audioSource;
//public ThoughtsManager th;
public string thoughtsTag;
public List<string> tempList = new List<string> ();
//Play thought from database here
public void PlaySavedThought(){
audioSource.Stop ();
tempList.Clear ();
thoughtsTag =("");
StartCoroutine(DownloadAudio());
}
public IEnumerator DownloadAudio()
{
// Create a URL and add parameters to the end of it.
string myURL = "HIDDEN";
myURL += "HIDDEN";
// Create our ES2Web object.
ES2Web web = new ES2Web(myURL);
// Start downloading our data and wait for it to finish.
yield return StartCoroutine(web.Download());
foreach (string tags in web.GetTags()) {
tempList.Add (tags);
}
if(web.isError)
{
// Enter your own code to handle errors here.
Debug.LogError(web.errorCode + ":" + web.error);
}
else
{
// We could save our data to a local file and load from that.
//web.SaveToFile("thoughts_tags.txt");
// Or we could just load directly from the ES2Web object.
thoughtsTag = tempList [Random.Range(0, tempList.Count)];
ERROR COMING FROM THIS LINE >>>> audioSource.clip = web.Load<AudioClip>(thoughtsTag);
audioSource.PlayOneShot (audioSource.clip, 0.7f);
}
}
}