First time using Unity with JavaScript and I am wondering how to enable/disable an Audio Source using Javascript. In my case I need to turn on the Audio Source when the mouse enters the collision area. ![]()
Here is the script I have written and I am wondering if I can make the Audio Source get enabled and then disabled on exit.
function OnMouseEnter()
{
renderer.material.color = Color.green;
}
function OnMouseExit()
{
renderer.material.color = Color.white;
}
Thanks.