-
Notifications
You must be signed in to change notification settings - Fork 342
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
-Use UNITY_2021_1 define for AssetDatabase.SaveAssets
- Loading branch information
chuanxin
committed
May 9, 2022
1 parent
a7cca20
commit b41b6d2
Showing
1 changed file
with
5 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
b41b6d2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't know if you'll answer here, in case you do:
Is this change a workaround for a known bug and fixed someday? Or will AssetDatabase.SaveAssetIfDirty be made obsolete. We're currently running into an issue where our builds fail due to: "error CS0117: 'AssetDatabase' does not contain a definition for 'SaveAssetIfDirty' (new); scripts have compiler errors." inside an editor script residing in a editor-only assembly. And only when building on our build-server, in batch-mode, not when done in editor locally. The documentation of the function does not state anything regarding that issue.
Also posted this on the forums if you'd like to answer there I'd be happy too: In Unity Forums
b41b6d2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, this is a workaround for the API (AssetDatabase.SaveAssetIfDirty) that was added to 2021.1.17. Unfortunately, there is no define for specifically identifying if the editor is of version 2021.1.17 and above. As the package is targeting Unity versions 2021.1 and above, but we still want to make use of this API for Unity versions 2021.2 and above, we added this ifdef.
Could you share which version of the Unity Editor you are using for your build server?
b41b6d2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, thanks for the reply!
I was pretty sure we'd use the same version on the build server as we use locally, since the whole team updated at the same time. I just checked and saw our build server was still on 2021.1.9f1! That explains the issue, sorry for not double-checking before asking here! 😳