1234567891011121314151617181920212223242526272829303132333435363738 |
-
- using UnityEngine;
- using System.Collections;
- namespace Valve.VR.InteractionSystem
- {
-
- public class SoundDeparent : MonoBehaviour
- {
- public bool destroyAfterPlayOnce = true;
- private AudioSource thisAudioSource;
-
- void Awake()
- {
- thisAudioSource = GetComponent<AudioSource>();
- }
-
- void Start()
- {
-
- gameObject.transform.parent = null;
- if ( destroyAfterPlayOnce )
- Destroy( gameObject, thisAudioSource.clip.length );
- }
- }
- }
|