Last active
October 15, 2023 17:21
-
-
Save Maoyeedy/1c8d91de1394427a9059bce4f3a21a8a to your computer and use it in GitHub Desktop.
Solution to Unity Asset Store "Open in Unity" button not working on Windows
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$EditorRootPath = "C:\Program Files\Unity\Hub\Editor" | |
$versions = Get-ChildItem -Directory $EditorRootPath | Select-Object -Expand Name | |
$latestVersion = ($versions | Sort-Object -Descending | Select-Object -First 1) | |
$unityExe = Join-Path $EditorRootPath "$latestVersion\Editor\Unity.exe" | |
Write-Host "Try registering URL:com.unity3d.kharma for $unityExe" | |
Remove-Item -Path "Registry::HKEY_CLASSES_ROOT\UnityAssetStore" -Recurse -ErrorAction SilentlyContinue | |
New-Item -Path "Registry::HKEY_CLASSES_ROOT\UnityAssetStore" | Out-Null | |
New-Item -Path "Registry::HKEY_CLASSES_ROOT\UnityAssetStore\DefaultIcon" | Out-Null | |
New-Item -Path "Registry::HKEY_CLASSES_ROOT\UnityAssetStore\Shell" | Out-Null | |
New-Item -Path "Registry::HKEY_CLASSES_ROOT\UnityAssetStore\Shell\Open" | Out-Null | |
New-Item -Path "Registry::HKEY_CLASSES_ROOT\UnityAssetStore\Shell\Open\Command" | Out-Null | |
Set-ItemProperty -Path "Registry::HKEY_CLASSES_ROOT\UnityAssetStore" ` | |
-Name "(Default)" -Value "URL:com.unity3d.kharma" | |
New-ItemProperty -Path "Registry::HKEY_CLASSES_ROOT\UnityAssetStore" ` | |
-Name "URL Protocol" -Value "" | |
Set-ItemProperty -Path "Registry::HKEY_CLASSES_ROOT\UnityAssetStore\DefaultIcon" ` | |
-Name "(Default)" -Value "'$unityExe',0" | |
Set-ItemProperty -Path "Registry::HKEY_CLASSES_ROOT\UnityAssetStore\Shell\Open" ` | |
-Name "FriendlyAppName" -Value "Unity $latestVersion" | |
Set-ItemProperty -Path "Registry::HKEY_CLASSES_ROOT\UnityAssetStore\Shell\Open\Command" ` | |
-Name "(Default)" -Value "'$unityExe' -openurl '%1'" | |
Write-Host "Registered successfully!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Run powershell as administrator and execute these lines.