# \[Editor Time\] How do you save a modified asset in C++? UE4 4.22

**URL:** <https://forums.unrealengine.com/t/editor-time-how-do-you-save-a-modified-asset-in-c-ue4-4-22/451673>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [July 3, 2019, 11:20pm UTC](https://forums.unrealengine.com/t/editor-time-how-do-you-save-a-modified-asset-in-c-ue4-4-22/451673 "2019-07-03T23:20:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![LDOGLONDON](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@LDOGLONDON](https://forums.unrealengine.com/u/LDOGLONDON)\
**Post date:** [July 3, 2019, 11:20pm UTC](https://forums.unrealengine.com/t/editor-time-how-do-you-save-a-modified-asset-in-c-ue4-4-22/451673/1 "2019-07-03T23:20:28Z")

</div>

Hi all,

Right now I’m trying to make a tool that allows me to edit a specific pawn class. I’ve made it only show the components I want to edit, a preview of the pawn, and certain properties on the currently selected component. Its basically setup like the BP editor, except its way less stuff and built using the new UEditorUtilityWidget class.

So I’m wondering now how I can save the changes made to the pawn instance of the asset into the blueprint that I’m editing. This is what my current save function looks like:

```
void UMyVehicleEditorUtility::SaveAsset()
{
	TArray<UPackage*> PackagesToSave;

	if (SelectedBlueprint != nullptr && SelectedBlueprint->IsAsset())
	{
		SelectedBlueprint->Modify();
		PackagesToSave.Add(SelectedBlueprint->GetOutermost());
	}
		

	FEditorFileUtils::PromptForCheckoutAndSave(PackagesToSave, bCheckDirtyOnAssetSave, 
    /*bPromptToSave=*/ false);
}

```

The “SelectedBlueprint” is a UBlueprint\* and in the editor i’m editing an AActor\*, which is spawned with this info:

```
FActorSpawnParameters SpawnInfo;
SpawnInfo.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
SpawnInfo.bNoFail = true;
SpawnInfo.ObjectFlags = RF_Transient | RF_Transactional;

```

Right now i’m just directly changing the values on the instance, so the actual UBlueprint doesn’t change. I think I need to mark the component I’m working on as **“dirty”** so it can mark its package as dirty, but I’ve been calling **UObject::Modify()** on those components and that didn’t seem to do anything.

I’ve also gone down the rabbit hole of using **SKismetInspector** to just create the regular details panel, but since my tool doesn’t derive from the **FBlueprintEditor** I don’t believe that I can use it properly. It did show up when I used it, but when I edited a property on a component, the details panel collapsed (or just went away) and when I tried saving the changes it didn’t stick.

**TLDR:  
How can I modify an instance of an object, during editor time, and save those changes to the blueprint (or asset)?**

sorry if this wasn’t clear, but the whole saving system in UE4 seems really complicated so its hard for me to rap my head around. Thanks for reading, any help is appreciated!

---

<div class="post-metadata">

**Author:** ![TigerFish89](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TigerFish89](https://forums.unrealengine.com/u/TigerFish89)\
**Post date:** [July 9, 2019, 9:31am UTC](https://forums.unrealengine.com/t/editor-time-how-do-you-save-a-modified-asset-in-c-ue4-4-22/451673/2 "2019-07-09T09:31:20Z")

</div>

Hi, I don’t know exactly. I have experienced saving utable useing GEditor-\>SavePackage.

---

<div class="post-metadata">

**Author:** ![\_483\_0](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@\_483\_0](https://forums.unrealengine.com/u/_483_0)\
**Post date:** [March 2, 2021, 8:19pm UTC](https://forums.unrealengine.com/t/editor-time-how-do-you-save-a-modified-asset-in-c-ue4-4-22/451673/3 "2021-03-02T20:19:22Z")

</div>

Did you solve the problem？  
I have the same issue with you.  
I wanan write some data into the components which save in editor’s runtime.

---

<div class="post-metadata">

**Author:** ![frankiezafe](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/frankiezafe/32/732708_2.png) [@frankiezafe](https://forums.unrealengine.com/u/frankiezafe)\
**Post date:** [September 26, 2023, 2:54pm UTC](https://forums.unrealengine.com/t/editor-time-how-do-you-save-a-modified-asset-in-c-ue4-4-22/451673/4 "2023-09-26T14:54:20Z")

</div>

Thanks, it was the way to go for me in 5.2.1!  
I needed to update a DataTable. To do so:

- load the asset via a `TSoftObjectPtr<UDataTable>`;
- regenerate the content of the DataTable;
- mark package and asset as dirty → `MarkPackageDirty()`;
- create save arguments with specifying `SAVE_KeepDirty` in the save flag

```auto
FSavePackageArgs args;
{
	args.TopLevelFlags = RF_Public | RF_Standalone;
	args.SaveFlags = SAVE_NoError | SAVE_KeepDirty;
}

```

- call `GEditor->SavePackage` and specify the second argument, `InAsset`.

By doing this, the editor detects the modification and flag the asset with a “\*” and warn you when you quit the editor without saving.
