Error – 'AssetDatabase' does not contain a definition for 'SaveAssetIfDirty'
Problem
Solution
This error appeared because the the Unity version that you are running does not have AssetDatabase.SaveAssetIfDirty() method.
To fix it you need to update your Unity version as follows:
For Unity 2020 – minimum version is 2020.3.16
For Unity 2021 – minimum version is 2021.1.17
Release notes for when this functionality was added:
2020.3.16 – Unity 2020.3.16 – Unity
2021.1.17 – Unity 2021.1.17 – Unity
API Changes
Asset Pipeline: Added: Added AssetDatabase.SaveAssetIfDirty() to save individual assets if required.