Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compilation with Unity 2020.3 #27

Merged
merged 3 commits into from
Mar 21, 2022

Conversation

Nezz
Copy link

@Nezz Nezz commented Feb 18, 2022

UIDocument was introduced in 2021.2, so this PR is needed to make Extenject work with older versions.

Pull request checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
  • No compiler errors or warnings

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

@Nezz
Copy link
Author

Nezz commented Feb 22, 2022

Actually this doesn't compile with 2021.2 out of the box because the UI Toolkit is a preview package that's not included. Any suggestions for how we could check whether the UI Toolkit is present? I didn't see any relevant precompiler defines.

@sbergen
Copy link

sbergen commented Mar 16, 2022

Actually this doesn't compile with 2021.2 out of the box because the UI Toolkit is a preview package that's not included. Any suggestions for how we could check whether the UI Toolkit is present? I didn't see any relevant precompiler defines.

Isn't this exactly what version defines are for?

@Nezz
Copy link
Author

Nezz commented Mar 17, 2022

@sbergen Thanks for the suggestion, this should make it work with all Unity versions. 2021 uses com.unity.modules.uielements, whereas 2020 used the com.unity.ui package.

@Nezz
Copy link
Author

Nezz commented Mar 21, 2022

@Mathijs-Bakker This should be ready for your review now. I have tested it with:

  • Unity 2020.3.19 without UI elements module & package (no UIDocument)
  • Unity 2020.3.19 with UI elements module but without package (no UIDocument)
  • Unity 2020.3.19 with UI elements module and package (has UIDocument)
  • Unity 2021.2.11 without UI elements module (no UIDocument)
  • Unity 2021.2.11 with UI elements module (has UIDocument)

@Mathijs-Bakker Mathijs-Bakker merged commit fffae33 into Mathijs-Bakker:master Mar 21, 2022
@Mathijs-Bakker
Copy link
Owner

OK! Merged!
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants