forked from Pugstorm/CoreKeeperModSDK
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOpenProject.ps1
More file actions
34 lines (26 loc) · 1.15 KB
/
OpenProject.ps1
File metadata and controls
34 lines (26 loc) · 1.15 KB
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
34
$editorVersion = "2021.3.14f1"
# Check if the UnitySetup module is installed
if (-not (Get-Module -ListAvailable -Name UnitySetup)) {
# Prompt to install the UnitySetup module
Write-Host "Installing UnitySetup module..."
Install-Module -Name UnitySetup -Scope CurrentUser -Force -AllowClobber
Write-Host "Done"
}
# Import the UnitySetup module
Import-Module UnitySetup
# Check if the desired Unity version is installed
$unityEditor = Get-UnitySetupInstance | Select-UnitySetupInstance -Version $editorVersion
if (-not $unityEditor) {
# Install Unity version
Write-Host "Installing Unity $editorVersion..."
# Note: You may need to adjust this command based on the components you need
Find-UnitySetupInstaller -Version $editorVersion -Components Windows | Install-UnitySetupInstance
$unityEditor = Get-UnitySetupInstance | Select-UnitySetupInstance -Version $editorVersion
if (-not $unityEditor) {
Write-Error "Installation failed or Unity path not found."
Read-Host "Press Enter to exit"
exit
}
Write-Host "Done"
}
& Start-UnityEditor -Version $editorVersion -Project (Get-UnityProjectInstance .\)