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

Post a reply

Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :arrow: :| :mrgreen: :geek: :ugeek:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: [Feature Request] Having the possibility to split variables in a struct as individual output port

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

by FunctionOverflu » 2025/04/25 17:35

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.

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

by caitsithware » 2025/04/25 15:28

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 😅

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

by FunctionOverflu » 2025/04/25 15:00

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!

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

by caitsithware » 2025/04/25 14:18

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.

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

by FunctionOverflu » 2025/04/25 13:46

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 3848 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 3848 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.

Top