-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCaptureUnity.ps1
More file actions
33 lines (26 loc) · 1001 Bytes
/
Copy pathCaptureUnity.ps1
File metadata and controls
33 lines (26 loc) · 1001 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
. "C:\hades\.codex_ops\AgentGuiOps.ps1"
Write-Host "Waiting for Unity window..."
$window = $null
for ($i = 0; $i -lt 60; $i++) {
$window = Get-AgentWindow -ProcessLike "Unity" -TitleLike "*Hecton8*"
if ($window) { break }
Start-Sleep -Seconds 5
}
if (-not $window) {
Write-Host "Failed to find Unity window."
exit 1
}
Write-Host "Found Unity window: $($window.Title)"
Write-Host "Waiting 20 seconds for Editor to finish layout..."
Start-Sleep -Seconds 20
Write-Host "Bringing window to front and sending Ctrl+P..."
Set-AgentWindowFront -Handle $window.Handle
Add-Type -AssemblyName System.Windows.Forms
[System.Windows.Forms.SendKeys]::SendWait("^p")
Write-Host "Waiting 20 seconds for Play Mode to generate terrain..."
Start-Sleep -Seconds 20
$outPath = "C:\hades\Hecton8\Docs\GeneratedAssets\Terrain\Screenshot.png"
Write-Host "Taking screenshot..."
Save-AgentWindowShot -Handle $window.Handle -Path $outPath
Write-Host "Screenshot saved."
Stop-Process -Name Unity -Force