For Unity project testing, an auto strategy is available, which will automatically pick up the Unity Editor version for the project being tested from that project's settings. However, for the first iteration of package testing, I didn't implement this feature.
It would be nice if the auto strategy were available for Package Testing as well.
Suggested solution
I think this can be accomplished by modifying the UnityVersionParser.read(projectPath) function. The modification could be to detect whether a package is being tested, and if so, parse the package's package.json for the Unity Editor version.
I believe the relevant fields in the package.json are unity and unityRelease - there are a couple of considerations to make with those fields:
Since those fields are not technically required (see the docs link in additional details), the auto strategy should be equipped to handle their absence and fail gracefully
The way they split up Unity version and Unity release into two fields may necessitate either modifying the UnityVersionParser.parse(projectVersionTxt) function, or creating a new function for parsing package versions altogether
Context
For Unity project testing, an
auto
strategy is available, which will automatically pick up the Unity Editor version for the project being tested from that project's settings. However, for the first iteration of package testing, I didn't implement this feature.It would be nice if the auto strategy were available for Package Testing as well.
Suggested solution
I think this can be accomplished by modifying the
UnityVersionParser.read(projectPath)
function. The modification could be to detect whether a package is being tested, and if so, parse the package'spackage.json
for the Unity Editor version.I believe the relevant fields in the
package.json
areunity
andunityRelease
- there are a couple of considerations to make with those fields:auto
strategy should be equipped to handle their absence and fail gracefullyUnityVersionParser.parse(projectVersionTxt)
function, or creating a new function for parsing package versions altogetherConsidered alternatives
n/a
Additional details
List of Unity Package Manifest (
package.json
) fields as of version 2023.2