Hey I have a question regarding Struct Variables.
I want to create an Octree so I made a Node struct. As usual with trees, nodes can contain other nodes(either 0 or 8 in this case) of the same struct type. Unfortunately, UE4 doesn’t allow me to select the Struct as a variable type.
So in my Struct SOctreeNode I want to have a array-variable called childs of the type SOctreeNode. How can I accomplish this?
I would also like to know that. Did you find a solution for that other than creating a Blueprint based on Actor?
There is struct support similar to class support you see in blueprints, but it does not have blueprint support. Same as C++ you do UClass*, you can use UStruct* there also *::StaticStruct() thing. Initiating struct from UStruct pointer is little bit complicated, as you need to allocate memory manually:
FMyStruct* StructVar
StructVar = FMemory::Malloc(MyUStruct->PropertiesSize);
MyUStruct->InitializeStruct(StructVar);
But oyu need to remeber refection system does not support any pointers other then UObjects (which needs to be pointers anyway), because of that there is no memory management of such pointer, you need ot deal with them manually (delete struct from memoery when containing object is being destroyed), if you don’t you will have memoery leakage.
And ofcorse without C++ here you can only dream