x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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 https://wiki.unrealengine.com/Interfaces_in_C%2B%2B .

Product Version: Not Selected
Tags:
more ▼

asked Mar 22 '15 at 08:42 PM in C++ Programming

avatar image

Vilepig
26 3 5 12

avatar image Vilepig Mar 22 '15 at 08:44 PM

I'm on 4.7.3

avatar image MetAksu Mar 22 '15 at 08:44 PM

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.

avatar image Duncan Dam Mar 23 '15 at 02:35 AM

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.

avatar image Vilepig Mar 23 '15 at 08:14 PM

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.

avatar image Duncan Dam Mar 24 '15 at 01:40 AM

You below must be class IInteractable not class IInterface

avatar image Vilepig Mar 24 '15 at 02:22 AM

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

avatar image Vilepig Mar 24 '15 at 02:25 AM

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?

avatar image Duncan Dam Mar 24 '15 at 02:51 AM

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

avatar image Vilepig Mar 25 '15 at 12:54 AM

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?

avatar image Duncan Dam Mar 25 '15 at 01:25 AM

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

alt text

capture.png (24.0 kB)
avatar image Vilepig Mar 25 '15 at 01:45 AM

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.

avatar image Vilepig Mar 25 '15 at 01:46 AM

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. alt text

avatar image Duncan Dam Mar 25 '15 at 01:54 AM

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.

avatar image Vilepig Mar 25 '15 at 01:58 AM

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

avatar image Duncan Dam Mar 25 '15 at 02:46 AM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

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.

more ▼

answered Mar 22 '15 at 08:44 PM

avatar image

MetAksu
1 1

avatar image Vilepig Mar 22 '15 at 09:16 PM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
more ▼

answered Aug 14 '16 at 03:12 PM

avatar image

Pelangi
256 22 34 42

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question