more
This commit is contained in:
@@ -8,3 +8,13 @@ ScriptedImporter:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}
|
||||
useAsTemplate: 0
|
||||
exposeTemplateAsShader: 0
|
||||
indexedData: {instanceID: 0}
|
||||
template:
|
||||
name:
|
||||
category:
|
||||
description:
|
||||
icon: {instanceID: 0}
|
||||
thumbnail: {instanceID: 0}
|
||||
order: 0
|
||||
|
||||
@@ -138,44 +138,6 @@ try {
|
||||
|
||||
$process.WaitForExit()
|
||||
|
||||
# -----------------------------
|
||||
# Wait for log file creation
|
||||
# -----------------------------
|
||||
$timeoutSeconds = 60
|
||||
$elapsed = 0
|
||||
|
||||
while (!(Test-Path $logFile) -and $elapsed -lt $timeoutSeconds) {
|
||||
Start-Sleep -Seconds 1
|
||||
$elapsed++
|
||||
}
|
||||
|
||||
if (!(Test-Path $logFile)) {
|
||||
throw "Unity log file was not created at: $logFile"
|
||||
}
|
||||
|
||||
# -----------------------------
|
||||
# Wait for file writes to finish
|
||||
# -----------------------------
|
||||
$previousLength = -1
|
||||
|
||||
do {
|
||||
$currentLength = (Get-Item $logFile).Length
|
||||
|
||||
if ($currentLength -eq $previousLength) {
|
||||
break
|
||||
}
|
||||
|
||||
$previousLength = $currentLength
|
||||
|
||||
Start-Sleep -Milliseconds 500
|
||||
|
||||
} while ($true)
|
||||
|
||||
# -----------------------------
|
||||
# Archive log
|
||||
# -----------------------------
|
||||
Copy-Item $logFile $artifactLog -Force
|
||||
|
||||
# -----------------------------
|
||||
# Build failed
|
||||
# -----------------------------
|
||||
@@ -221,7 +183,4 @@ try {
|
||||
catch {
|
||||
Write-Error $_.Exception.Message
|
||||
exit 1
|
||||
}
|
||||
finally {
|
||||
Write-Host "Cleanup complete."
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
# CleanUnityProject.ps1
|
||||
# Run this script from your root Unity project directory.
|
||||
|
||||
$ProjectRoot = Get-Item .
|
||||
|
||||
# 1. Verification checks
|
||||
if (!(Test-Path (Join-Path $ProjectRoot "Assets")) -or !(Test-Path (Join-Path $ProjectRoot "ProjectSettings"))) {
|
||||
Write-Error "Error: This does not look like a Unity project root directory. 'Assets' or 'ProjectSettings' folder missing."
|
||||
Exit
|
||||
}
|
||||
|
||||
Write-Host "Starting Unity project cleanup in: $($ProjectRoot.FullName)" -ForegroundColor Cyan
|
||||
|
||||
# 2. Define folders and files safe to delete
|
||||
$TargetFolders = @("Library", "Temp", "Logs", "obj","Builds")
|
||||
$TargetExtensions = @("*.csproj", "*.sln", "*.userprefs")
|
||||
|
||||
# 3. Delete target directories
|
||||
foreach ($Folder in $TargetFolders) {
|
||||
$FolderPath = Join-Path $ProjectRoot $Folder
|
||||
if (Test-Path $FolderPath) {
|
||||
Write-Host "Removing directory: $Folder..." -ForegroundColor Yellow
|
||||
Remove-Item -Path $FolderPath -Recurse -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
|
||||
# 4. Delete target IDE files
|
||||
foreach ($Ext in $TargetExtensions) {
|
||||
$Files = Get-ChildItem -Path $ProjectRoot -Filter $Ext
|
||||
foreach ($File in $Files) {
|
||||
Write-Host "Removing file: $($File.Name)..." -ForegroundColor Yellow
|
||||
Remove-Item -Path $File.FullName -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "Cleanup complete! It is now safe to back up your project or open it fresh in Unity." -ForegroundColor Green
|
||||
Reference in New Issue
Block a user