Why can't i modify/suppress delegates in an AActor constructor?

Hey everyone,

I define some functions to be called in case of hovering/clicking in the constructor of an AActor derived class.

This has been working for a long time (4.5 ou 4.6), until i tried to change one of the delegate functions in the current 4.7.

Here, the commented lines are the original one, and the uncommented are the test ones.

//OnBeginCursorOver.AddDynamic(this, &AYagActor::HighlightOn);
//OnEndCursorOver.AddDynamic(this, &AYagActor::HighlightOff);
//OnClicked.AddDynamic(this, &AYagActor::AskForPossessionOnlyIfNotPined);
OnBeginCursorOver.AddDynamic(this, &AYagActor::AskForPossessionOnlyIfNotPined);
OnEndCursorOver.AddDynamic(this, &AYagActor::AskForPossessionOnlyIfNotPined);
OnClicked.AddDynamic(this, &AYagActor::AskForPossessionOnlyIfNotPined);

The test ones are never taken into account, even if i suppress all the lines, the old functions are still called in game, despite not being called in the code any longer !

AskForPossessionOnlyIfNotPined() begins with a GEngine->AddOnScreenDebugMessage message that is never displayed. Even with the exact above code, the HighlightOn and highlightOff functions are still called when hovering the actor with the mouse cursor.

I can change some other parameters in the constructor and they are taken into account, but not those 3 lines.

The function are called nowhere else in the code.

I have stopped the editor, cleaned the solution, rebuild it entirely, but it makes no difference.

I am not able to change nor suppress the delegates defined in the constructor.

Maybe there is a huge error in my code right under my nose, but i can’t see it. Any idea where i could look ?

Thanks

Cedric

I deleted the BP derived from the class and remade a new one (using the same parent class).

Then it worked, the new delegates were correctly taken into account.

I guess i’ll never know what happened, but at least i can go on, knowing that when i change a delegate in the constructor, i’d better rebuild my BP class from scratch…

Not sure if it’s a bug or me being ignorant.

Oh well…

It has to do with how the uasset is saved out and reloaded. After the object is constructed, it’s properties get loaded from the uasset. So if you had originally bound the delegate in the constructor, then the object was saved with that delegate bound to it, and if you changed the signature, it stops working as expected.

I’m having this problem right now and it’s extremely frustrating.