21 lines
759 B
PowerShell
21 lines
759 B
PowerShell
# Unity 脚本编译检查
|
|
# 用法:在修改 src/Unity/Assets/Scripts/ 后运行此脚本
|
|
# 退出码 0 = 编译成功,非 0 = 有错误
|
|
|
|
$unityEditor = "C:\Program Files\Unity\Hub\Editor\2022.3.62f3c1\Editor\Unity.exe"
|
|
$projectPath = "C:\Users\Tellme\apps\CounterDroneBackend\src\Unity"
|
|
$logFile = "C:\Users\Tellme\apps\CounterDroneBackend\unity_build.log"
|
|
|
|
Write-Host "Compiling Unity scripts..."
|
|
& $unityEditor -batchmode -quit -projectPath $projectPath -executeMethod CompileCheck -logFile $logFile 2>&1 | Out-Null
|
|
|
|
$errors = Select-String -Path $logFile -Pattern "error CS" -SimpleMatch
|
|
if ($errors) {
|
|
Write-Host "BUILD FAILED:"
|
|
$errors | ForEach-Object { Write-Host $_.Line }
|
|
exit 1
|
|
} else {
|
|
Write-Host "BUILD SUCCESS"
|
|
exit 0
|
|
}
|