I did some research. The problem is caused in CoreNative.cpp.
In Function GetInstancedSubobject (Line 126)
We should check if instance is runtime instance first. If it is runtime instance, just use current value. Otherwise use the parent value. So I did some code change in Function GetInstancedSubobject like below,
if ( bShouldInstance ) { // check bIsRuntime first bool bIsRuntimeInstance = CurrentValue != SourceSubobject && CurrentValue->GetOuter() == CurrentObject; if (bDoNotCreateNewInstance || bIsRuntimeInstance) { InstancedSubobject = CurrentValue; } else { // do anything else ... } }
UCLASS(EditInlineNew, DefaultToInstanced, Abstract, BlueprintType, Blueprintable) class INSTANCETESTPROJECT_API USubObject : public UObject { GENERATED_BODY() public: UPROPERTY(EditAnywhere) FString String; }; UCLASS(BlueprintType, Blueprintable, meta = (BlueprintSpawnableComponent)) class INSTANCETESTPROJECT_API UExampleComponent : public UActorComponent { GENERATED_BODY() public: UPROPERTY(EditAnywhere, Instanced) class USubObject* SubObject = nullptr; }; UCLASS(BlueprintType, Blueprintable) class INSTANCETESTPROJECT_API ATestBPChildGameModeBase : public AGameModeBase { GENERATED_BODY() ATestBPChildGameModeBase() { ExampleComp = CreateDefaultSubobject<UExampleComponent>(TEXT("ExampleComp")); } public: UPROPERTY(EditAnywhere) class UExampleComponent* ExampleComp; };
2. Create New Blueprint in Editor from native class ATestBPChildGameModeBase, named as ParentGM.
3. Set SubObject in ParentGM as "parent"
4. Create New Blueprint in Editor from ParentGM, named as ChildGM
5. Set SubObject in ChildGM as "child"
6. Save all and close Editor
7. Reopen Editor, the SubObject in ChildGM is "parent"
I am not able to find world outliner how to enable it?
How can i modify the param name in EQS node
Undefined sysmbol: typeinfo for AActor when cross-compile linux dedicated server on windows
What properties of the progress bar can be used for drag and drop highlighting?
What property of the Slider is the image used when dragging?
How to achieve HLSL Multiple Render Target in Material blueprints?
How do I change the rotation matrix of the camera by the direction of the vector?
Teleporter in the Creative Hub is Locked and cannot be accessed
When I open UE4 4.24.3 it appears that. Does anyone know how to solve?
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-102315 in the post.
0 |
Component | UE - Gameplay - Components |
---|---|
Affects Versions | 4.25.3 |
Created | Nov 2, 2020 |
---|---|
Resolved | Jul 19, 2022 |
Updated | Jul 19, 2022 |