Constucting a struct variable in c++
Given a function such as one below
How can I construct a struct from the UStruct passed in as parameter? The struct will be passed in from Blueprint.
Edit : I am trying to construct a struct in the scope of the function as though I am creating a new object, for example, calling
However, even though UStruct is derived from UObject, I cannot use NewObject() to construct a new struct based on the UStruct* param.
Take a look at
If you need the struct instance to outlive your current scope then you'll either have to put
answered Sep 28 '17 at 02:15 PM
Jamie Dale STAFF
I am not sure what you are asking, but I'll give it a try.
If you are trying to define a ustruct then on on your .h file add a definition like so:
then you will have to pass a variable like this to your function:
but the definition must be as follows:
Now, if the function is hardcoded and you already have the struct you should try to cast your pointer:
but I am not sure that would work. Also you can try a
answered Sep 28 '17 at 11:29 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here