PlayOneShot was called with a null AudioClip?,"PlayOnShot was called with a null AudioClip" came out of nowhere?
I wrote a code that make a Jump and Death sound. It worked but since I added Unitys particle system everything went like woosh. I am 2hour struggling to figure out whats wrong. I am throwing out my whole project if it is because the project would be broken. It dont matter anymore. I am just depressed because of this "family friendly word" I already tried undo everything but it didn't worked.
Here is the code if there is a Hero out here that could solve this please:
using System.Collections; using System.Collections.Generic; using UnityEngine; public class SoundManagerScript : MonoBehaviour { public static AudioClip jumpSound, deathSound; static AudioSource audioScr; private void Start() { jumpSound = Resources.Load <AudioClip> ("Jump"); deathSound = Resources.Load <AudioClip> ("Death"); audioScr = GetComponent<AudioSource>(); } public static void Playsound (string clip) { switch (clip) { case "jump": audioScr.PlayOneShot(jumpSound); break; case "death": audioScr.PlayOneShot(deathSound); break; } } }
,Hello Guys!
I tried to make a Jump sound and it worked so far... I tried to add particles to my movement and the sound went gone. I did everything undo but still no sound and THIS PROBLEM. I am working for a soluton since 1am and it is now 3am. I dont want any more of this stuff.
using System.Collections; using System.Collections.Generic; using UnityEngine; public class SoundManagerScript : MonoBehaviour { public static AudioClip jumpSound, deathSound; static AudioSource audioScr; private void Start() { jumpSound = Resources.Load <AudioClip> ("Jump"); deathSound = Resources.Load <AudioClip> ("Death"); audioScr = GetComponent<AudioSource>(); } public static void Playsound (string clip) { switch (clip) { case "jump": audioScr.PlayOneShot(jumpSound); break; case "death": audioScr.PlayOneShot(deathSound); break; } } }
This is the Code. Please... I need a Hero that could help me!
Ok I discovered something. Unity somehow renamed my Resources folder as Recource
So for any new ones here: Your SoundScript and Sound needs to be in the Resources folder!!!!
Your answer
Follow this Question
Related Questions
What's wrong with my audiostream on android? 0 Answers
Trying to get a key to play a sound when it is interacted with and disappears. Csharp 2 Answers
Is there any plugin to get talk back voice (like Talk Tom) 0 Answers
Nuance Dragon Speech Recognition in Unity 1 Answer
Second AudioClip won't play 0 Answers