Thursday 26 April 2012

Unity Code


Trigger code


function OnTriggerEnter()
{
audio.Play();
}

function OnTriggerExit()
{
audio.Stop();
}



Interactive code



function OnMouseDown()
{
audio.Play();
}

function OnMouseUp()
{
audio.Stop();
}



Collision code


function OnCollisionEnter()
{
audio.Play();
}