param( [Parameter(Mandatory = $true)] [ValidateSet("Windows","Android")] [string]$Target ) Write-Host "=== Windows Build Starting ===" Write-Host "Target: $Target" $config = Get-Content ".\ci\toolchain.json" | ConvertFrom-Json $unityVersion = $config.unityVersion $unityRoot = $config.windows.unityRoot $unityExe = Join-Path $unityRoot "$unityVersion\Editor\Unity.exe" if (!(Test-Path $unityExe)) { throw "Unity not installed: $unityExe" } # ---------------------------- # Toolchain setup (Windows agent) # ---------------------------- Write-Host "Ensuring toolchain (Unity + Android SDK/JDK/NDK)..." # NOTE: In real setups you either: # - rely on Unity Hub installs, OR # - preinstalled cached toolchain # This script assumes preinstalled Hub-managed tools. # ---------------------------- # Select Unity method # ---------------------------- $method = switch ($Target) { "Windows" { "BuildScript.Windows" } "Android" { "BuildScript.Android" } } & $unityExe ` -batchmode ` -nographics ` -quit ` -projectPath $PWD ` -executeMethod $method ` -logFile - if ($LASTEXITCODE -ne 0) { throw "Build failed: $Target" } Write-Host "=== Build SUCCESS: $Target ==="