用于音频数据的容器。
AudioClip 存储压缩为 Ogg Vorbis 或未压缩的音频文件。
AudioSource 引用和使用 AudioClip 播放声音。
另请参阅:组件参考中的 AudioClip 组件。
ambisonic | 如果该音频剪辑为立体混响声,则返回 true。(只读) |
channels | 音频剪辑中的声道数。(只读) |
frequency | 剪辑的采样频率(以赫兹为单位)。(只读) |
length | 音频剪辑的长度(以秒为单位)。(只读) |
loadInBackground | 对应于 Inspector 中的“Load In Background”标志,当设置该标志时,将在不阻塞主线程的情况下延时加载。 |
loadState | 返回与 AudioClip 关联的音频数据的当前加载状态。 |
loadType | 剪辑的加载类型。(只读) |
preloadAudioData | 加载剪辑资源时预加载剪辑的音频数据。当该标志关闭时,脚本必须调用 AudioClip.LoadAudioData() 来在播放剪辑前加载数据。加载音频数据前,可以使用长度、声道和格式等属性。 |
samples | 样本中音频剪辑的长度。(只读) |
GetData | 使用剪辑中的样本数据填充数组。 |
LoadAudioData | 加载剪辑的音频数据。设置了“Preload Audio Data”的剪辑将自动加载音频数据。 |
SetData | 在剪辑中设置样本数据。 |
UnloadAudioData | 卸载与该剪辑关联的音频数据。这仅适用于基于实际声音文件资源的 AudioClip。 |
Create | 使用名称和给定的样本长度、声道和频率创建用户 AudioClip。 |
PCMReaderCallback | 每次 AudioClip 读取数据,都将调用委托。 |
PCMSetPositionCallback | 每次 AudioClip 更改读取位置时,都将调用委托。 |
GetInstanceID | Gets the instance ID of the object. |
ToString | 返回对象的名称。 |
Destroy | 移除 GameObject、组件或资源。 |
DestroyImmediate | 立即销毁对象 /obj/。强烈建议您改用 Destroy。 |
DontDestroyOnLoad | 在加载新的 Scene 时,请勿销毁 Object。 |
FindObjectOfType | 返回第一个类型为 type 的已加载的激活对象。 |
FindObjectsOfType | Gets a list of all loaded objects of Type type. |
Instantiate | 克隆 original 对象并返回克隆对象。 |
bool | 该对象是否存在? |
operator != | 比较两个对象是否引用不同的对象。 |
operator == | 比较两个对象引用,判断它们是否引用同一个对象。 |
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.