Why my collisions are behaving weird?

Hey, I added collision over OnComponentBeginOverlap->AddDynamic.
It worked, so my function was called everytime.

Then I added 2 spheres and added also collision the same way with an extra 2 functions (all UFunctions).

Now:

Only my sphere collisions are called - only their functions are called, not that of the capsule…
And it gets weirder… I removed all AddDynamics from my constructor, closed the editor, recompiled and tried it out…
The sphere functions get called, even I don’t subscribe to any collision event.

It’s not a compilation error or misfunction, because when I delete the content of my collision functions, this content isn’t executed anymore , but the function itself. Is that a engine bug or so? I cannot explain this behaviour.

Hey, as soon as I added the sphere collisions, I renamed my capsule collide method from OnCollide to OnCapsuleCollide. Since then it stopped working.
Now I renamed it back and it works, WITHOUT AddDynamic/binding.

I guess, the method names are serialized even if you remove the binding in the constructor, or change the binded method, it still uses the first method you gave it.

Think it’s a bug because that should not happen / is awful.

Hope a dev sees it and acknowledges.

Cheers

Hi ,

Are you still experiencing this type of error in 4.6?

Sorry, but I can not see that the error is fixed for me.

What kind of blueprint is this taking place in?

No one, it takes place in my subclass of APawn in C++ code. In the constructor I place my Dynamic bindings.
I tried to remove one now, but it still triggers. So the bug isn’t fixed yet.

Hi ,

Sorry for the delay in getting back to you on this. Would you be able to provide the code you are using in your APawn subclass? If you can reproduce this in a new project, you could also that and upload it and we can take a look at what is happening.

Hi ,

We have not heard back from you for a few days. Do you still need help with this issue? I will be marking this question as resolved for tracking purposes, but please feel free to re-open the question at any time if you need any more help.

Hi, sorry for the delay, here is my code: #pragma once#include "GameFramework/Pawn.h"#include "MainPawn.generate - Pastebin.com (Header) #include "SpaceDive.h"#include "MainPawn.h"#include "AsteroidSpawn.h"# - Pastebin.com (Impl)

No matter if I remove the AddDynamics, my callbacks are still called. This shouldn’t happen I think.

I looked into this again today using the code that you provided (thank you for that). I noticed a couple things that I wanted to confirm are also happening for you.

First, when I open the Blueprint that I created from MainPawn and go to the Components tab, the main viewport starts displaying a series of “Hit” string messages.

Closing the Blueprint or switching to a different tab stops adding new messages and they eventually all disappear.

Second, when in PIE/Simulate mode, I see only three messages stating “1.#INF”.

26682-pie.png

Do these results match what you see?

I cannot confirm any of what you encounter. Maybe there are weird things, because you have missing links to my other classes?

ASpaceDivePlayerState and UHighscoresSaveGame is referenced

I had commented out references to three other classes in order to get my test project to build. I spent most of today trying to rebuild a minimum version of the pawn that reproduces what I was seeing with the code you provided. I was able to get it to where I was seeing some of the same behavior that I saw with yours, so I think I am getting close to figuring out what is happening.

The second image that I posted above I discovered was due to the SphereDivider variables being set to 0. Once I put a valid value in those, the message displayed when I entered PIE was more normal.

I was able to see the same messages in the first image when using my pawn class, but they only started to appear after I added the AddDynamic lines to my class. There does seem to be something odd happening there. However, when I commented out those lines in my class, the messages stopped appearing. This is different from what I was seeing in your class, because I had those lines commented out and would still see those messages. I will have to do some more digging to find out why having these lines commented out in your class did not stop the messages from appearing (and I suspect that will tell us why you were seeing the results that you had).

Yes thanks for your investigation. I forgot to say, that you need to blueprint, to set valid values. It took many time, until I figured out the problem, that once I add a collision it would never go away. Because of that possibility being so absurd, I first didn’t check it out. Good luck finding the errors.

Hi ,

Today I scrapped my previous test project and created a new one to start over again from the beginning. Oddly enough, when I brought in your sample code this time I didn’t see any of the Hit messages that I was seeing previously.

I created a new Pawn class that contained a camera, capsule, and two spheres, then mirrored your set up with debug lines stating which component has been entered. I was able to see all of the appropriate messages with the AddDynamic lines present, and with those lines removed none of the messages were displayed.

Have you noticed the behavior that you described in any other classes, or is your pawn class the only one where you are using AddDynamic?

My pawn class is the only one, that makes use of AddDynamic binding.

I was able to see the same results that you described in my project today. However, when I attempted to make it happen again in a clean project, using the same code, everything is behaving normally again. I think I may be getting closer to pinpointing what is happening, though.

Ok good luck I hope you can track the error.

Hi ,

I apologize for the lengthy delay on this issue. I was actually able to reproduce this same issue completely by accident while working on something else. It seems like the key thing that I was missing earlier was performing a hot reload. I typically do not include a hot reload when testing something unless it is a necessary part of reproing the issue. For this issue, apparently performing a hot reload, any hot reload, results in the dynamic delegate bindings in the code class becoming a permanent part of any Blueprints that had been created from that class prior to the hot reload. I have submitted a report about this to have it investigated further (UE-12873).

I was also able to find a couple workarounds, though depending on the situation they may not be very helpful. First, try to avoid using the hot reload capability in the Engine if you are using dynamic delegate binding in any code classes until this issue is resolved. Unfortunately this option removes one of the most helpful capabilities of the Engine (for programmers).

Also, I found that if I created a brand new Blueprint after the hot reload, the bindings worked as expected. This is ONLY the case if the Blueprint is brand new and created AFTER the hot reload happened. Simply deleting an instance of the old Blueprint from the level and replacing it with a new instance of the old Blueprint won’t work. Depending on how complex the Blueprint is, and the number of instances there are in the level, this option may be prohibitive.

Hey , I am glad to hear, that you could reproduce this issue.
Currently, the problem isn’t affecting my work, because I did the collision part of my project.
When the problem gets fixed, are all delegates automatically bound correctly, or do I have to create new blueprints nevertheless?

Unfortunately I cannot really say at this point how we will decide to fix this issue, so I don’t know what steps will need to be taken after the fix is in place. Hopefully it will be as simple as updating to the version of the Engine that contains the fix, but it is possible that it may still be necessary to recreate the Blueprints. I’ll try to test for that when I am notified that a fix is in place.