using UnityEngine;
public class CollectCoin : MonoBehaviour
{
public AudioSource coinFX;
void OnTriggerEnter(Collider other)
{
coinFX.Play();
ColectableControl.coinCount += 1;
this.gameObject.SetActive(false);
}
}
The error comes from this code and the error is saying
ArgumentNullException: Value cannot be null.
Parameter name: source
UnityEngine.AudioSource.Play () (at :0)
CollectCoin.OnTriggerEnter (UnityEngine.Collider other) (at Assets/Scripts/Colectables/CollectCoin.cs:9)
,using UnityEngine;
public class CollectCoin : MonoBehaviour
{
public AudioSource coinFX;
void OnTriggerEnter(Collider other)
{
coinFX.Play();
ColectableControl.coinCount += 1;
this.gameObject.SetActive(false);
}
}
The null error comes from this script