[Feature Request] Having the possibility to split variables in a struct as individual output port

FunctionOverflu
Posts: 17
Joined: 2025/03/29 09:07

[Feature Request] Having the possibility to split variables in a struct as individual output port

Post by FunctionOverflu »

Hello,

It will be really nice to be able to split a struct data output into individual variable data output like one can do in Unreal Blueprint.
https://dev.epicgames.com/documentation ... eal-engine

Because sometimes we are only interested in certain variables in a struct, but don't want to explicitly write a compute component to just to access them from the struct itself. I believe it will save a lot of time in general.

One usecase I have is whenever an AI is attacked, a Damage event is triggered and it passes in a `DamageData` struct.
Inside `DamageData` stores the damage amount and the aggressor/attacker.
My AI logic will set an "Opponent" variable to reference DamageData.Attacker.

There are two ways to achieve this in Unreal:
1. Splitting struct output ports directly
Screenshot 2025-04-25 154319.png
Screenshot 2025-04-25 154319.png (54.38 KiB) Viewed 3844 times
2. Using a Break Struct node (this is probably the easier option?)
Screenshot 2025-04-25 154412.png
Screenshot 2025-04-25 154412.png (66.85 KiB) Viewed 3844 times
For option 2 I can probably write a custom evaluate component to split the struct into variables, but that will be a lot more extra works and code to maintain.
User avatar
caitsithware
管理人
Posts: 133
Joined: 2024/03/26 01:56

Re: [Feature Request] Having the possibility to split variables in a struct as individual output port

Post by caitsithware »

Hello,

I have already made a note of field splitting as an issue to consider.

Taking user-defined types into account will require the use of the script generation function, so I am considering option 2, but since an equivalent script can be generated by creating a Split method in the first place, I think this is a low priority.
At the moment, types such as Vector3 are also provided with a Split extension method included.

As for option 1, the issue is how to generate the splitting code, so I don't have any prospects for it at this time.

Thank you for your feedback.
FunctionOverflu
Posts: 17
Joined: 2025/03/29 09:07

Re: [Feature Request] Having the possibility to split variables in a struct as individual output port

Post by FunctionOverflu »

Thank you for the response!

I thought of code generation but I personally don't really like code generation (I prefer explicit control over the code).
Also then I will have to separate scripts into assemblies :lol: :lol: (I am lazy when it comes to that)
I guess I will just have to sit down and finally organize my scripts into assemblies now :P

But I didn't know Extension functions could also work in this case as well (so I don't have to put the split method inside the struct itself).
Thanks for the tip!
User avatar
caitsithware
管理人
Posts: 133
Joined: 2024/03/26 01:56

Re: [Feature Request] Having the possibility to split variables in a struct as individual output port

Post by caitsithware »

There is another way to access fields, using reflection, but it is expensive, so I would like to avoid this as much as possible.
There is no access method that does not use code generation or reflection, so this would be impossible 😅
FunctionOverflu
Posts: 17
Joined: 2025/03/29 09:07

Re: [Feature Request] Having the possibility to split variables in a struct as individual output port

Post by FunctionOverflu »

Yeah, no problem!
At the moment I will just do what you did with Vector3, having a split extension function and generate node code for that function.
Post Reply