How can I create an interface?

I want to create an interface class so I can easily give functionality to multiple different classes. It appears that the UINTERFACE macro is gone so I can’t use this tutorial A new, community-hosted Unreal Engine Wiki - Announcements - Unreal Engine Forums .

I’m on 4.7.3

Yea I’ve been having this problem too, I’ve just been getting around it by creating abstract classes and creating sub classes of them.

Yea I’ve been having this problem too, I’ve just been getting around it by creating abstract classes and creating sub classes of them.

Yea I’ve been doing this as well, but its limiting me in a couple ways.

What u mean UINTERFACE is gone, my interface code which i follow the tutorial still working on 4.7.3. So what error you have when you follow the tutorial, post some screenshot if you can.

I’m trying to create the interface like this. The problem is that I have no generated header file and from looking at example interfaces, the UINTERFACE macro is defined in the generated header.

You below must be class IInteractable not class IInterface

I got it to work earlier by just creating my own generated header. (and I changed that)

the UINTERFACE macro and the GENERATED_IINTERFACE_BODY() macros are defined in the generated header. Do you know how to make unreal automatically generate one so I don’t have to manually edit the generated header?

why u need to add manually one, it always auto generated for you, if you have GENERATED_UINTERFACE_BODY(), and all that macro is from engine code not from the generated file. This work similar with GENERATED_BODY() macro

So would I just write the UInferface class with the GENERATED_UINTERFACE_BODY() and compile and then create the IInterface class and put in the UINTERFACE() macro?

Here one of my interface header, u can put both of them in together, no need t put which one first.

I understand that, but if you look at my earlier picture, UINTERFACE() and GENERATED_IINTERFACE_BODY() were not defined anywhere. I had to manually create my own generated header to get it to recognize them because those macros are defined in the generated header.

I have it working now, but for the future, it would be nice to know how to get the generated header to be automatically created.

Strange, anything which is .generated.h is automatically created i never need to add any .generated.h before, for mine i just add the code like above, rebuild project and it work. Build tool it’s supposed to create the .generated.h file.

I thought that was to case too. Did you add your interface files in visual studio?

not exactly, i add in VS but it not appear in source folder directory so then i need to move the file in Source Folder, after that i do Generate VS project file again from .uproject, then rebuild.

Read the docs from UE instead of that Wiki: