insert a song into a script?

im adding an easter egg to my game and i need to know how to insert a song into a script…

the script i am using is

void Update() 

{ 

//call the collision function

OnCollisionEnter() 

}

//collision function

void OnCollisionEnter(Collision collision) 

{ 

if(Input.GetKey("space") && collision.gameObject.tag == "redbutton") 

{

//insert play sound here

}

}

i need to know how to insert the song into where it says \\insert play sound file here… please help

EDITED: I noticed you’re calling OnCollisionEnter in Update. You don’t call this function, just define it - the system calls it automatically when a collision occurs. I altered your script to fix this.

Add an Audio Source to the object, import the song with Assets->Import new asset… and set the Audio Clip field to the song. Play the song using audio.Play():

//void Update() 
//{ 
// you should not call the collision function, it's invoked
// automatically by the system when a collision occurs
// OnCollisionEnter() <- NO! 
//}

//collision function
void OnCollisionEnter(Collision collision) 
{ 
	if(Input.GetKey("space") && collision.gameObject.tag == "redbutton") 
	{
		audio.Play();
	}
}

You must also disable Play On Awake in the audio source, or the song will play when the game starts (not a good thing for a eastern egg, for sure!).