Improve method of finding Unity version
See original GitHub issueCurrently, the target version of Unity comes from the defines in the .csproj (e.g. UNITY_5_5
). This doesn’t work for external class libraries, where the define isn’t set manually, and if the version isn’t set
The version should come from /ProjectSettings/ProjectVersion.txt
, or even from the editor itself via the protocol (although this doesn’t help class libraries).
See #121 for more context, and examples of how to get the version
Issue Analytics
- State:
- Created 5 years ago
- Comments:13 (12 by maintainers)
Top Results From Across the Web
A way to check Unity version in a project
To view the version your project was built with you can open the ProjectSettings.asset with NotePad++ or something similar and the version ......
Read more >How to know Unity version of an Unity project without open ...
How to know Unity version of an Unity project without open it? ... Under ProjectSettings in the project folder there's a ProjectVersion.txt.
Read more >Finding the Name and Editor Version Used in Unity Projects
The editor version used to create the project is found on the very first line of the file. All that is necessary to...
Read more >The best way to upgrade your Unity project to a newer ...
The best way to upgrade your Unity project to a newer version of Unity. ... Find the Shader in the Project folder with...
Read more >Application.version - Scripting API
This function returns the current version of the Application. This is read-only. To set the version number in Unity, go to Edit>Project Settings>Player....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It may be worth noting that
ProjectSettings/ProjectVersion.txt
doesn’t get proactively saved by Unity when you open a project with a newer version of Unity. (Which frustrates me.)User must trigger the save for the new version to be written out. (Not sure about all of the entry-points for that to happen, other than Cmd/Ctrl-S or File->Save Project.)
Your layered approach will account for this, I just wanted to mention this issue if you didn’t already know about it.
EDIT: This is only for external class libraries, right? Any reason to not tell authors via a build error that they should add a project define for the Unity version they’re targeting?
So, in order of priority, most accurate to least:
ProjectSettings/ProjectVersion.txt
. This is the least reliable, as it really reflects the version of Unity that last saved the project, and could be different to currently open. Class libraries might not even have this file.sln.dotSettings
And also show version information in the settings page, with a message where it came from.