Description

Consider a C++/BP class containing an EditAnywhere/InstanceEditable variable with type (UDataAsset*), (UPrimaryDataAsset*), or any of their subclasses. When setting this variable using a Property Editor (for example, on the Details Panel for an Actor instance placed in the world), the asset picker correctly displays all Data Asset Instances derived from the chosen parent. However, if the user picks a Data Asset Instance created from a Blueprint - which was in turn derived from (UPrimaryDataAsset*) or some other blueprintable subclass of (UDataAsset*) - the selection is ignored unless that parent Blueprint had been previously loaded for some other reason.

The problem seems to be related to function SPropertyEditorAsset::SetValue() in [Engine\Source\Editor\PropertyEditor\Private\UserInterface\PropertyEditor\SPropertyEditorAsset.cpp:1030]. The test "CanSetBasedOnCustomClasses(AssetData)" calls "AssetData.GetClass()", which in turn calls "FindObject<UClass>(AssetClassPath)". This last call tries and fails to find the generated class for the base blueprint asset that has not been loaded yet.

Note that the problem does not occur if the Data Asset instance is derived from a native class such as (UDataAsset*) or one of its subclasses. In that case, "AssetClassPath" points to the native class inside a "/Script/..." path, which is always found. Also, the problem does not occur when selecting an unloaded blueprint directly (for a variable that accepts one instead of a Data Asset), even if its parent blueprint is also unloaded. This is because the "AssetClassPath" of the input AssetData is simply "Blueprint" (inside package "/Script/Engine"), and not the specific generated class of the asset or its parent.

As a related problem - but possibly with a different root cause - consider a Data Asset Instance created in the Editor from a C++ class derived from (UDataAsset*) or (UPrimaryDataAsset*). In the Content Browser, this asset is shown with a reddish color and the BP thumbnail, and its tooltip identifies it as a "Data Asset". Now consider a Blueprint derived from (UPrimaryDataAsset*) or some other blueprintable subclass of (UDataAsset*), and a Data Asset Instance created from that. In the Content Browser, the data asset instance is initially shown with a white color and no thumbnail, and its tooltip displays its full class path. The behavior is fixed once the base Blueprint is loaded: now the data asset instances created from it are correctly identified in the Content Browser.

 

Steps to Reproduce

1. In C++, define a class "UCppPrimaryDataAsset" derived from UPrimaryDataAsset.
2. Compile the project and run the Editor.

3. Create a Blueprint "BP_PrimaryDataAsset" derived from UPrimaryDataAsset. Compile and save.
4. Create a Data Asset "DA_CppDataAsset" based on CppPrimaryDataAsset
5. Create a Data Asset "DA_BP_DataAsset" based on BP_PrimaryDataAsset
6. Create a Blueprint "BP_MyActor" derived from AActor. Add a variable "Var_DataAsset" of type PrimaryDataAsset. Compile and save.
7. Place an instance of BP_MyActor in the level.
8. Close and reopen the Editor.

9. Select the instance of BP_MyActor in the level.
10. In the details panel, set "Var_DataAsset" to "DA_CppDataAsset". It works correctly.
11. In the details panel, set "Var_DataAsset" to "DA_BP_DataAsset". It does not work.
12. In the Content Browser, right-click "BP_PrimaryDataAsset" and choose "Asset Actions – Load"
13. In the details panel of the BP_MyActor instance, set "Var_DataAsset" to "DA_BP_DataAsset". It works correctly.

14. Also note that, after restarting the Editor and before loading "BP_PrimaryDataAsset", asset "DA_BP_DataAsset" is not displayed correctly in the Content Browser. After loading the blueprint and switching the Content Browser to another folder and back, the Data Asset is displayed correctly.

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-223076 in the post.

9
Login to Vote

Unresolved
ComponentUE - Gameplay - Blueprint
Affects Versions5.45.3
CreatedSep 3, 2024
UpdatedSep 11, 2024
View Jira Issue