I’m going for points.
I have to say that you probably have much more experience than me in C++, but there are things that I don’t agree with you.
"I honestly think you are overcomplicating the solution right now, because the “UObjectWrapperReturning” is actually a worse solution than a struct. Both are classes, but the “U"on UObjectWrapperReturning implies the object you return inherits from the UObject class, which does a ton of different things that you don’t need to pass data along.”
Using a struct or a UObject class may depend on what you need to do.
Sometimes there is more than one way to solve a problem, in my case, using a structure did not solve the problem. Therefore, if something “complicated” and easy for me solves the problem, then I choose to solve the problem. They are objects and are much more powerful than a structure.
Therefore, I opted for a Wrapper object which apparently worked correctly, since as I said Unreal Engine is a C++ “Custom” (now I’m going to go into depth with this).
“An object worse than a structure.”
I don’t agree with that statement at all. Each one has a purpose. An Object may involve more cost but it has more modularity, more power and more necessary functions such as serialization, network functions, inheritance, polymorphism or others.
Personally, I will always use OOP Objects, since not all programming languages have structures.
“It’s all OOP.”
Wrong.
The structures are not literally OOP, that is, they are in some of the OOP programming languages.
If I now move to my Java API to access certain resources, I don’t have to use any Structs. If I have to do Typescript I don’t use Structs. No, I don’t just do Unreal Engine Custom C++. I do more things. In my case, I can’t afford to only work with C++.
Therefore, from my point of view if someone is touching several languages “I strongly and fervently recommend” not using Structs.
But you do what you’re good at, if it works for you, I have no problem.
But think that if you change language everything will be with Objects. There are no Structs in other languages.
In other words, you can use structs in object-oriented programming, but the structs themselves are not object-oriented and are not object-oriented in other programming languages. Structures are simply a way to group related variables in one place.
“It’s not custom C++, UE does a lot behind the scenes with macros which is why you need to add UPROPERTY, UFUNCTION, GENERATE_BODY, UCLASS and whatnot.”
When you modify the standard of a language in this case C++ to adapt it to your needs as Unreal Engine does, and as you say with the macros and the entire reflection system and that there are “limitations”, you are having a very personalized and limited C++ code or closed. Therefore, there are many limitations on the part of UE5 since it has custom C++ code, apparently I cannot use the full potential in UE5.
I have recently come to C++, I come from Java and I see clearly that Unreal Engine is “custom” code, you can call it whatever you want. If you prefer to say no, that’s fine with me. What I did of wrapping an object is not complicated at all. In Java there are things much more complex than this nonsense of wrapping a class.
“The garbage collector will not clean the variable as long as it is in scope or referenced in a UPROPERTY. the collector walks a chain of references, anything without a reference is cleaned.”
I totally agree with the statement, however, you would be surprised to know that the garbage collector (of each IDE/ENGINE) is capable of giving you headaches. For that reason, I said “you can use whichever you need the most if “*” or TSoftObjectPtr”.
I am not the garbage collector and I don’t want one day to say… “oops, the application closed”, therefore, it is better to always say it. Like a band-aid. You can skip it if you are going to remember all the variables and their scope of your application.
Although a variable may be in scope, that alone does not guarantee that the object it points to will not be collected by the garbage collector. I prefer it never happens to me. Personal opinion.
“Structs, datatables…”
They can be very powerful as you mention, but I disagree with you. I prefer to use OOP, without structures or datatables or other types. Why won’t I use them? Because they are exclusive to certain programming languages. Are they powerful? Of course, no one says otherwise.
“data tables can be exported to csv/json” seems interesting.
Thanks for your time. I’m just a guy who only applies OOP instead of using anything language specific. I don’t think it’s bad.