GENERATED_BODY() is inaccessible

I need to create an array of Models, but i cant create a new Model object. Is this a bug?
This is for an ODBC Plugin im creating.

When using GENERATED_BODY macro, it will automatically put you in the private scope. So basically, put your public: AFTER the GENERATED_BODY not before, this should solve your problem.

I’ve tried both ways

You other error states that you use your variable as an object instead of a poniter (. instead of ->). Basically, I would need to see more of the code :slight_smile:

UDatabaseCommunicatorModel *Model = NewObject(Query->QueryModel);

will compile, but my Model has an array of columns that is not being copied to the new Model

Other errors are because of that one line. The code compiles fine if I don’t try to create a new Model. But then my Model array all points to the same columns

The ModelColumns array?

Basically there are an array of columns in a Model. Think of the model as a table row. Then the Model belongs to a query. When the get query results function is executed it should return an array of that model with the column values. Everything is working but I cant seem to create new models. I’ve only managed to create an array of model pointers all pointing to the same model lol

Thx for the help btw.

Everything is working but I cant seem to create new models.

But you also said :

UDatabaseCommunicatorModel *Model = NewObject(Query->QueryModel);

worked…so I,m not sure I’m following. From the screenshots above, you have a totally different problem…and what is the “GENERATED_BODY() is inaccessible” have to do with youor problem than?

Well GENERATED_BODY() is still inaccessible so I’m trying to work around. My new post How do I convert a uobject pointer to a normal local variable? - Editor Scripting - Epic Developer Community Forums

I seem to be going in circles trying to figure this out. Sry for the confusion

What do you mean by GENERATED_BODY() is not accessible? It’s a macro that does stuff “behind the scene” for your class, what do you want it to do? I’m not sure I’m following, please explain what you are trying to do with that macro?

Also like I said earlier, the macro ends in private scope. Basically your “public:” before GENERATED_BODY() is useless.

Maybe I’m missing something, but I don’t think so!


In the cpp youll notice i was just trying to make a local copy of a pointer.
I found out that unreal makes u use NewObject() function to do this. But now im stuck copying all the pointers properties manually.

This is what i was looking for:

UDatabaseCommunicatorModel* Model = Cast(Query->QueryModel);

Normal C++ casting doesnt work on UObjects