How do I put an audiosource in a variable?

Hi, I’m really new to the audio aspect of Unity, so I got a very simple question: How do I fix this? This is a script attached to an audio source object, with an audio clip. I’m trying to make it a background music, and as an example I’m trying to making it so that when I press the “F” key on the keyboard, the music starts. It’s in the C# language.

using UnityEngine;
using System.Collections;

public class playThisSound : MonoBehaviour {

	AudioSource levelmusic;

	// Use this for initialization
	void Start () {

	// Update is called once per frame
	void Update () {

		if (Input.GetKeyDown(KeyCode.F))


I get the error

Assets/playThisSound.cs(6,21): warning CS0649: Field ‘playThisSound.levelmusic’ is never assigned to, and will always have its default value ‘null’

So where do I place the statement? I think it’s very simple but I can’t figure it out.

Instead of having a variable, because the script is attached to the same object as the AudioSource you can just do:

if (Input.GetKeyDown(KeyCode.F))
    audio.Play(); refers to the AudioSource attached to the object, if there is one.