基本内容如下:
1 // sound 音频 2 AudioSource audioSource = new AudioSource (); 3 audioSource.Play (); // 播放 4 audioSource.Stop (); // 停止 5 audioSource.Pause (); // 暂停 6 audioSource.isPlaying (); // 是否在播放 7 8 // 动态的在代码中获取声音资源并且播放出来 9 short[] data = null; // 数据,必须是short类型的 10 AudioClip audioClip = AudioClip.Create ("", sizeof(HostData), 2, 6400, false); 11 audioClip.SetData (data, 0); 12 13 audioSource.clip = audioClip; 14 audioSource.Play (); 15 16 17 18 // movie 视频 19 20 // pc 21 MovieTexture movieTexture; 22 movieTexture.Play (); 23 movieTexture.Stop (); 24 25 // ios/android 26 Handheld.PlayFullScreenMovie ("", Color.blue, FullScreenMovieControlMode.CancelOnInput, ScaleMode.ScaleAndCrop); 27 28 // record 录音 29 AudioClip audioClipRecord = Microphone.Start ("", true, 1, 6400); 30 Microphone.devices (); // 获取所有设备
时间: 2024-10-26 21:53:05