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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

How to build a template/generic class derived from UObject?

I am trying to build a data structure that can serve as a container for multiple objects that also inherits from UObject (so it can be managed by the garbage collector), but I getting build errors when I add the template to the class. I've looked at the documentation for template classes, but I can't seem to find much help. Is there a specific way to create template classes in UE4? Is this something that I am going to have to do in raw c++?

Product Version: Not Selected
Tags:
more ▼

asked Jul 13 '14 at 05:59 PM in C++ Programming

avatar image

burgerbob
133 10 11 19

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

1 answer: sort voted first

Hi burgerbob,

UObject-derived classes need to be parsed by UnrealHeaderTool which generates reflection data for them. Unfortunately, at this point UHT does not support templated UObjects.

If GC is the only thing you want from UObject land, then you could try inheriting from FGCObject and overriding its AddReferencedObjects method to manually add any UObject references when GC runs.

more ▼

answered Jul 14 '14 at 07:02 AM

avatar image

robert.manuszewski STAFF
318 8 3 9

avatar image Kirkules May 19 '17 at 06:17 PM

Is this answer still accurate? Are templated UObjects supported now?

avatar image Nachtmahr May 19 '17 at 09:39 PM

Nope still not supported =) we get there someday

avatar image burgerbob May 19 '17 at 09:57 PM

Completely forgot to mark this as correct, but as Nachtmahr stated, this is still the case.

(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