whats the right way to inherit a USTRUCT?

I’m trying to inherit a FHitResult, so I can add some extra parameters to it. What I have here mostly works, but when I break the hit result in blueprints, only my two extra variables show, and I cannot see the parent’s variables. How can I fix this?

USTRUCT(BlueprintType)
struct Ftw_HitResult : public FHitResult {
	GENERATED_BODY()
		
	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "tw", Meta = (DisplayName = "Total trace time") )
	float total_trace_time;

	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "tw", Meta = (DisplayName = "Velocity") )
	float velocity;
};

Thank you for trying to help me scott. You are right, there is almost never a “need” for inheritance, it is a convenience tool. This is the first time I found a use for it but it was easy to work without it.

Your suggestion will not work at all with my setup because those variables don’t mean what they might appear to mean.

However, if this is not possible, it really should be a feature request. This was just my first day working with a USTRUCT, and I’m sure there will be bigger problems later without proper inheritance.

if inheritance is helpful for the datatype, you should probably use a UObject, since blueprint allows object and actor inheritance, but not UStruct inheritance.

for inherited UStructs that you want to use in blueprints, the best you can do is create a new struct which contains the parent struct as one of its members.

for custom hit trace logic, which works with various actors, you can call an interface function on the OtherActor, which can return those Velocity/Time values.

If this answer is correct then I will gladly give you an upvote. I would like someone to verify that USTRUCTS cannot be inherited. Is this documented somewhere?

change the property from EditDefaultsOnly to EditAnywhere.