Search Issue Tracker
Fixed
Fixed in 2022.3.29f1, 6000.0.0b16, 7000.0.0a1
Votes
0
Found in
2022.1.0a1
2022.2.0a9
2022.3.0f1
2023.1.0a4
2023.2.0a6
2023.3.0a3
6000.0.37f1
6000.1.0a7
6000.2.0a1
7000.0.0a1
Issue ID
UUM-66169
Regression
No
AssetDatabase.SaveAssetIfDirty does not automatically check out assets
Steps to reproduce:
1. Set up a project under VCS (e.g. P4) with at least one asset in it.
2. Make a script that calls EditorUtility.SetDirty() on the asset
3. Call AssetDatabase.SaveAssetIfDirty() on the asset
\\
Actual results:
Asset is not checked out in source control
Expected results:
Asset is checked out in source control
\\
Reproducible with versions:
2020.3 onwards (landed in 2022.1, and backported)
Not reproducible with versions:
Can’t test with versions:
\\
Tested on (OS):
macOS, Windows
\\
Notes:
- Can use something like this to test :
{code:c#}
[MenuItem("Test/Test Version Control Checkout")]
private static void TestVersionControlCheckout()
{
var asset = LoadScriptableObject(); // load an asset
asset.stringField += "_NewContent"; // make some changes
EditorUtility.SetDirty(asset);
// AssetDatabase.SaveAssets(); // ok, will checkout the asset
AssetDatabase.SaveAssetIfDirty(asset); // not ok, will not checkout the asset
}
{code}
Originally raised on the forums: https://forum.unity.com/threads/the-version-control-system-wont-checkout-changed-assets-when-using-assetdatabase-saveassetifdirty.1554779/#post-9685544
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- StackOverflowException occurs and tests fail to load when the Test Runner window is opened while System.Windows.Forms.dll and System.Deployment.dll are present in the project
- Some UXML Template Asset foldouts appear enabled when all fields inside are disabled
- URP Terrain Demo crash on burst_signal_handler after Generating lighting
- Project window button icons are poorly visible and their shades differ in Light theme
- Automatic LOD fails and SRP Batcher incompatibility occurs when using spline-based quad-topology meshes
Add comment