AudioSource.playOnAwake 唤醒时播放

var playOnAwake : bool

Description描述

If set to true, the audio source will automatically start playing on awake

如果设置为true,音频源将在Awake时自动播放。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	void Awake() {
		if (!audio.playOnAwake)
			audio.Play();

	}
}
if(!audio.playOnAwake) {
	audio.Play();
	// Play the clip if it wasn't set to play on awake
	//如果没有在Awake设置时,播放剪辑
}
Page last updated: 2011-4-5