Error CS0120: An object reference is required to access non-static member `UnityEngine.AudioSource.Play ()' on how to solve it?

Here is the whole code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PickUpCoin : MonoBehaviour {

 public static AudioSource PickUpCoins;

 public int Coins;

 void Start () {
 PickUpCoins = GetComponent <audiosource> ();
}
 void OnTriggerEnter(Collider other) {
 if (other.tag == "Coin")
{
Coins++;
 UnityEngine.AudioSource.Play ();
Destroy(other.gameObject);
}
}
 void OnGUI() 
{
 GUILayout.Label("Coins =" + Coins);
}
}</audiosource>
June 8th 19 at 16:26
1 answer
June 8th 19 at 16:28
Solution
Need to replace the UnityEngine.AudioSource on PickUpCoins.
Thank you very much! - nikita.Stracke commented on June 8th 19 at 16:31

Find more questions by tags C#Unity Game Engine