The current implementation of AutoCreateRefTerm does not allow for a default value to be automatically created for a TArray contained within a struct that is passed into a function as a parameter. It is possible to have a default for the entire struct created, but not for a specific TArray(s) within the struct. If the function is called in a Blueprint and the default Make node is used for the struct, any TArray input pins that do not have anything connected to them will cause the compilation to fail. The same result occurs if the struct input pin is split.
USTRUCT(BlueprintType) struct FTestStruct { GENERATED_BODY() UPROPERTY(BlueprintReadWrite, meta = (DisplayName = "target List")) TArray<class AActor*> targets; UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = TestCat) TArray<int32> TestVar; FTestStruct() {}; };
UFUNCTION(BlueprintCallable, meta = (AutoCreateRefTerm = "InStruct")) static const int32 GetBestTarget(const FTestStruct& InStruct); const int32 AMyActor::GetBestTarget(const FTestStruct& InStruct) { return 1; }
RESULT:
The Blueprint fails to compile with an error showing for each TArray input pin. Eg. The current value of the ' Target List ' pin is invalid: Array inputs (like 'Target List') must have an input wired into them (try connecting a MakeArray node).
EXPECTED:
The Blueprint compiles successfully.
WORKAROUND:
Adding a HasNativeMake meta property to the USTRUCT allows the creation and use of a custom Make function for the struct, where AutoCreateRefTerm can be specified for each paramter.
I am not able to find world outliner how to enable it?
Delay nodes occasionally don't fire the "Completed" output in a nativized build
An error occurred while trying to generate project files !?
Undefined sysmbol: typeinfo for AActor when cross-compile linux dedicated server on windows
How to capture a screen Use CineCameraComponent without SceneComponent2d
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-55051 in the post.
0 |
Component | UE - Gameplay |
---|---|
Affects Versions | 4.18.3, 4.20 |
Target Fix | 4.25 |
Created | Feb 9, 2018 |
---|---|
Resolved | Mar 12, 2020 |
Updated | Jul 30, 2020 |