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

Cannot play a disabled audio source?

$
0
0
So I've been struggling over my code for a few hours with no luck. I'm trying to play and audio clip when walking into a box collider on top of a sword. But instead of playing the audio clip, I get the error "Cannot playa disabled audio source." It's very frustrating and I am quite confused. This is my code below: using System.Collections; using System.Collections.Generic; using UnityEngine; public class Pickup2 : MonoBehaviour { public GameObject RealSword; public GameObject FakerSword; public AudioSource stab; // Use this for initialization void Start() { GetComponent(); } // Update is called once per frame void Update() { } private void OnTriggerEnter(Collider other) { if (gameObject.tag == "MegaFake") RealSword.SetActive(true); FakerSword.SetActive(false); stab.Play(); Any help is incredibly appreciated!

Viewing all articles
Browse latest Browse all 2891

Trending Articles



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