Version: 2020.3

IActiveBuildTargetChanged.OnActiveBuildTargetChanged

切换到手册
public void OnActiveBuildTargetChanged (BuildTarget previousTarget, BuildTarget newTarget);

参数

previousTarget 更改之前的构建目标。
newTarget 新的活动构建目标。

描述

更改活动构建平台时,系统会自动调用此函数。

另请参阅:SwitchActiveBuildTarget

using UnityEngine;
using UnityEditor;
using UnityEditor.Build;

public class ActiveBuildTargetListener : IActiveBuildTargetChanged { public int callbackOrder { get { return 0; } } public void OnActiveBuildTargetChanged(BuildTarget previousTarget, BuildTarget newTarget) { Debug.Log("Switched build target to " + newTarget); } }