Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
function Install-UnityLicense($user, $pass, $key) {
$programDataDirectory = "C:\ProgramData\Unity"
$unityProgram = "C:\Program Files\Unity\Editor\Unity.exe"
# Attempt to Return License first
Start-Process -FilePath $unityProgram -NoNewWindow -Wait -ArgumentList '-batchmode','-quit','-returnlicense'
# Delete programDataDirectory
Write-Output "-- Checking if path $programDataDirectory exists"
If (Test-Path $programDataDirectory){
Write-Output "Removing $programDataDirectory"
Remove-Item -Recurse $programDataDirectory
}
#Launch Unity
Start-Process -FilePath $unityProgram -NoNewWindow
Start-Sleep -s 15
Stop-Process -processname Unity
#License unity with provided username, password, and key
& $unityProgram -batchmode -username $user -password $pass -quit -serial $key
Start-Process -FilePath $unityProgram -NoNewWindow -Wait -ArgumentList "-batchmode","-username $user","-password $pass","-quit","-serial $key"
}
Install-UnityLicense user@email.com password SERIAL-KEY-HERE