Hello,
I’m pretty new to Unreal, so it’s highly possible I’m doing something wrong here.
I’m getting this error:
Can't save [...]/LVL_TestSave.umap: Graph is linked to external private object MyCustomAssetUserData /Game/Blueprints/BP_Generated.BP_Generated_C:MyObject.MyCustomAssetUserData_0 (AssetUserData)
(edited with generic names).
I’ve searched online and on the forums for a solution, but anything I found either did not work, or wasn’t related to my problem.
Here is my issue: I created a custom Asset User Data class in my plugin, and when I put an auto-generated blueprint using this class in my level, I cannot save it anymore.
The file tree of the plugin looks something like this:
File Tree
PluginName/Source/PluginName/
Private/
PluginName.cpp
AddAssetUserData.cpp
GenerateBP.cpp
Public/
PluginName.h
AddAssetUserData.h
GenerateBP.h
MyCustomAssetUserData.h
PluginName.Build.cs
This is how I define the class:
MyCustomAssetUserData.h
// MyCustomAssetUserData.h
#pragma once
// Class includes
#include "Engine/AssetUserData.h"
#include "MyCustomAssetUserData.generated.h"
UCLASS(BlueprintType)
class UMyCustomAssetUserData : public UAssetUserData
{
GENERATED_BODY()
public:
UMyCustomAssetUserData()
: Path(FString(""))
{}
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FString Path;
};
And this is how I add the data to the scene components:
AddMyAssetUserData
template<typename T>
void AddMyAssetUserData(T* Component, FString Path) {
UMyCustomAssetUserData* Data = NewObject<UMyCustomAssetUserData>(Component);
Data->Path = Path;
Component->AddAssetUserData(Data);
Component->Modify(); // Mark as modified to make sure the changes get saved
}
I’ll explain how the error occurs:
- When I add custom data to a scene or actor component, I can save fine.
- When I create a BP from an actor using custom data (
FKismetEditorUtilities::CreateBlueprintFromActor
), I can save fine. - When I add the generated BP to the level, I cannot save and get the error.
Thanks in advance for the help.