Version: 2017.3

AssetPostprocessor.OnPreprocessAudio()

切换到手册

描述

Add this function in a subclass to get a notification just before an audio clip is being imported.

借助此函数,您可以通过代码控制导入设置。

using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;

public class MyAudioPostprocessor : AssetPostprocessor { void OnPreprocessAudio() { if (assetPath.Contains("mono")) { AudioImporter audioImporter = (AudioImporter)assetImporter; audioImporter.forceToMono = true; } } }