unitysetup.powershell
unitysetup.powershell copied to clipboard
Get-UnityLicense fails because the versioning is malformed
Unity's license file doesn't always have well formed version definitions.
My personal license says it's for 2017.2.0 which is invalid to the UnityLicense this module expects.

Cannot convert value "2017.2.0" to type "UnityVersion". Error: "Invalid unity version: 2017.2.0"
At C:\Users\shodgson\Documents\WindowsPowerShell\Modules\UnitySetup\4.0.97\UnitySetup.psm1:1016 char:24
+ ... 'Serial' = ConvertTo-SecureString $licenseSerial -AsPlainText -Force ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvalidCastConstructorException
Digging in a bit deeper I noticed our regex expression when parsing the version out may need to be updated a bit.
https://regex101.com/r/7AGvpa/2
Adding an | can match either the short version for long version (Also, seems to be faster too?!)
Likely we'll also need to update the match count check
This is still an issue and should be reopened. I just got an error saying Cannot convert value "2017.2.0" to type "UnityVersion". Error: "Invalid unity version: 2017.2.0" when running Get-UnityLicense.
This is also still an issue for both my Pro and Personal licenses
It seems 2017.2.0 is being applied when license is activated via Unity Hub. If license is activated via command line with specific Unity.exe, license has that version
Why's this been closed again? I don't see any changes that look relevant since it was reopened, and the only comment here in the meantime is repro instructions and an explanation of why not everyone's been able to reproduce the problem when they've tried.
Because it's never gonna be addressed, and I've moved onto other tools
I reopened, as this project is still actively maintained even if Stephen is moving on. If someone want to make a PR to support short versions in the licensing I'm happy to review. =)
Fix available in 5.5.156-develop.