Download

Well here's a tricky one for you: how can I have two ustructs that contain each other?

So I’m trying to build a conversation tree that easily can be edited in the editor.

So I have responses and conversation structs in c++.
Each response contains a conversation that contains a response that contains a conversation etc.

So something like this:

struct A
{
struct B b;
};

struct B
{
struct A a;
};

Now, this obviously does not compile since struct A does not know what struct B is.
To make matters worse they need to be blueprint UStructs.

Any help here or other ideas?


struct A
{
struct B* b;
};

struct B
{
struct A* a;
};

Make A and B children of a base struct C then forward declare A and B on C’s header file before including it to A and B’s headers.

Yes both of these would work if…and this is a big if I didn’t have to keep both as Blueprint accessible.
The whole reason behind this is so that folks can easily edit these settings in the editor so them being displayed in the editor is incredibly important.
To my knowledge I can not forward declare a UStruct and have it as blueprint implementable.



USTRUCT()
struct FDataA
{
 ...
};

USTRUCT()
struct FDataB
{
...
};

UCLASS()
class A
{
 class B* b;
 FDataA data;
};

UCLASS()
class B
{
 class A* a;
 FDataB data;
};


Missing GENERATED_BODY and public: