1- ---
2- # PowerShell script for Windows to create symlinks
1+ # PowerShell script for Windows to create symlinks
32# Requires Developer Mode enabled OR running PowerShell as Administrator
43
54$ErrorActionPreference = " Stop"
65$scriptDir = Split-Path - Parent $MyInvocation.MyCommand.Path
76$sampleUnity6Assets = Join-Path $scriptDir " sample-unity6\Assets"
87
9- Write-Host " Setting up symlinks for sample-unity6..." - ForegroundColor Cyan
8+ Write-Output " Setting up symlinks for sample-unity6..."
109
1110# Check if running with sufficient privileges
1211$currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity ]::GetCurrent())
1312$isAdmin = $currentPrincipal.IsInRole ([Security.Principal.WindowsBuiltInRole ]::Administrator)
1413
1514if (-not $isAdmin ) {
16- Write-Host " WARNING: Not running as Administrator." - ForegroundColor Yellow
17- Write-Host " If symlink creation fails, either:" - ForegroundColor Yellow
18- Write-Host " 1. Enable Developer Mode (Settings > Update & Security > For developers)" - ForegroundColor Yellow
19- Write-Host " 2. Run PowerShell as Administrator" - ForegroundColor Yellow
20- Write-Host " "
15+ Write-Output " WARNING: Not running as Administrator."
16+ Write-Output " If symlink creation fails, either:"
17+ Write-Output " 1. Enable Developer Mode (Settings > Update & Security > For developers)"
18+ Write-Output " 2. Run PowerShell as Administrator"
19+ Write-Output " "
2120}
2221
2322# Remove existing directories/symlinks if they exist
@@ -34,21 +33,21 @@ try {
3433 New-Item - ItemType SymbolicLink - Path " Scripts" - Target " ..\..\sample\Assets\Scripts" | Out-Null
3534 New-Item - ItemType SymbolicLink - Path " Scenes.meta" - Target " ..\..\sample\Assets\Scenes.meta" | Out-Null
3635 New-Item - ItemType SymbolicLink - Path " Scripts.meta" - Target " ..\..\sample\Assets\Scripts.meta" | Out-Null
37-
38- Write-Host " "
39- Write-Host " ✅ Symlinks created successfully!" - ForegroundColor Green
40- Write-Host " "
41- Write-Host " Scenes and Scripts in sample-unity6 now point to sample/Assets" - ForegroundColor Green
36+
37+ Write-Output " "
38+ Write-Output " ✅ Symlinks created successfully!"
39+ Write-Output " "
40+ Write-Output " Scenes and Scripts in sample-unity6 now point to sample/Assets"
4241 Get-ChildItem | Where-Object { $_.Name -match " Scenes|Scripts" } | Format-Table Name, LinkType, Target
4342}
4443catch {
45- Write-Host " "
46- Write-Host " ❌ Failed to create symlinks!" - ForegroundColor Red
47- Write-Host " Error: $_ " - ForegroundColor Red
48- Write-Host " "
49- Write-Host " Please enable Developer Mode:" - ForegroundColor Yellow
50- Write-Host " Settings > Update & Security > For developers > Developer Mode: ON" - ForegroundColor Yellow
51- Write-Host " Then run this script again." - ForegroundColor Yellow
44+ Write-Output " "
45+ Write-Output " ❌ Failed to create symlinks!"
46+ Write-Output " Error: $_ "
47+ Write-Output " "
48+ Write-Output " Please enable Developer Mode:"
49+ Write-Output " Settings > Update & Security > For developers > Developer Mode: ON"
50+ Write-Output " Then run this script again."
5251 exit 1
5352}
5453
0 commit comments