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. 

DECLARE_FUNCTION and Interface Casting issues in 4.18 / 4.19

Hey there. We switched to 4.19 yesterday and nothing works anymore, as expected :P

We use a lot of DECLARE_FUNCTION and CustomThunk in our project for custom UProperty serialization, however DECLARE_FUNCTION now operates statically and instead seems to pass an context UObject instead. I though it would be as easy as simply casting the UObject to the appropriate class but the cast crashes. The DECLARE_FUNCTION is within an IInterface class, which the Context object in fact inherits from, but both Cast<> and even ImplementsInterface both crash. They don't return false, they crash...

So yeah, DECLARE_FUNCTION in an IInterface.. Anyone any experience with this?

I am doing some research at the moment what is causing it, and something really weird is emerging. I can inspect the Context value and it contains all the data expected and inherits the Interface class, however when casting, the GetClass() on that UObject returns some suuuuuper unrelated Animation-Object class?! What the heck is going on there? Context->GetClass() returns "(Name=0x0000013c776e1040 "/Game/Audience/People/Lily/Animations/Reactions/Negative/HeadShake/Lily_Reactions_Negative_HeadShake_H_01"_2)", that's some random animation from our app. The UObject itself is of USEUser, the primary user class.... I doubt I could thing of two things less related in our app. Really weird.

When inspecting the Context UObject in Visual Studio before the cast, it has two UObjectBaseUtility implementations, one on the top level, that refers to that weird animation class (and also has a lot of "Invalid" params in it?!) and one that roots back the usual way, U*YourClass* (USEUser in my case) -> UObject -> UObjectBaseUtility, where PrivateClass is actually the proper class...

alt text Thanks a lot!

Product Version: UE 4.19
unbenannt.png (103.3 kB)
more ▼

asked Apr 29 '18 at 12:15 PM in C++ Programming

avatar image

96 8 15 25

avatar image MykonCodes Apr 29 '18 at 04:53 PM

Got a workaround by simply doing an C-style cast instead.. Would still like to know why this is happening though. The same code works fine for DECLARE_FUNCTION and Cast<> in non-interface implementations.

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

0 answers: sort voted first
Be the first one to answer this question
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