Trakteer

Membuat Suara Audio Selesai Lalu Destroy Object Unity

 using UnityEngine;

using System.Collections;



public class Star : MonoBehaviour {


    public ParticleSystem StarParticle;


    public AudioClip otherClip;


    IEnumerator OnTriggerEnter (Collider player)

    { 

        ScoreManager.score += 1;



        StarParticle.Play ();


        AudioSource audio = GetComponent<AudioSource>();

        audio.Play();

        yield return new WaitForSeconds(audio.clip.length);


        Destroy (gameObject);


    }

}

 

Mohon Aktifkan Javascript!Enable JavaScript