The question is answered, right answer was accepted
Audiosource unlinks
Hi,
When I try to run the audio in my script, the audio unlinks from the empty and I get an error saying "MissingComponentException: There is no 'AudioSource' attached to the "PushbackAudioProcedureEmpty" game object, but a script is trying to access it.". I have a video demonstrating the issue.
Video: https://youtu.be/E79hWNMJSTQ
Any ideas how to fix this?
Answer by DcoltGaming · Mar 10, 2017 at 11:12 PM
I now know "As soon as you call the method, you're resetting the public field. The GetComponent call will fail because the component is on the child object and not on the parent."
How do I fix this?
Fixed using code: using System.Collections; using System.Collections.Generic; using UnityEngine; public class PushbackAudio : $$anonymous$$onoBehaviour { %|1808424508_1|% %|-1181940566_2|% { %|2095395030_5|% %|113040832_6|% %|2026387070_7|% }
Removing the getcomponent call