Search Unity

Sound error

Discussion in 'Editor & General Support' started by an3d, Dec 30, 2010.

  1. an3d

    an3d

    Joined:
    Feb 24, 2010
    Posts:
    52
    Hello,

    I have a script (coconut thrower) with a sound attached...but when i trow the coconuts a different sound in my project is playing (sometimes) also very loud. arrrgghhh

    Is this a bug in Unity?

    var myCoconutPrefab : Rigidbody;
    var throwForce : int = 20;
    var throwClip : AudioClip;
    static var onPlate : boolean = false;

    function Update () {


    if(onPlate){

    if(Input.GetButtonDown("Fire1")){

    var Coconut : Rigidbody = Instantiate(myCoconutPrefab, transform.position, transform.rotation);
    Coconut.velocity = transform.TransformDirection(Vector3 (0,0,throwForce));
    Physics.IgnoreCollision(Coconut.collider, transform.root.collider);
    audio.PlayOneShot(throwClip);

    }

    }

    }