Search Issue Tracker

Active

Fixed in 2022.3.29f1, 6000.0.0b16

Under Consideration for 6000.1.X

Votes

0

Found in

2022.1.0a1

2022.2.0a9

2022.3.0f1

2023.1.0a4

2023.2.0a6

2023.3.0a3

6000.1.0a7

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

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.