I was just giving an example of where we use a code generator in our projects. The set of remote procedure calls (RPCs) offered by a service is specified in a .proto file, and then we run a python script that reads that .proto file and generates a .h/.cpp file containing a UCLASS that is a service client, and has a member function for each RPC.
A code generator is just a script that writes a text file. There is nothing mysterious about it. For example, here is a python script that writes the hello world program in C:
print('#include "stdio.h"\n')
print('int main() { printf("Hello, World!"); }')
and then run it like:
$ python myscript.py > hello.c
and viola - a code generator.