Custom blueprint callbacks don't get called unless I press compile on each level blueprint

Hello,

This issue happens randomly and I can detect it while playing in editor or even worse in a packaged build…

I have my custom blueprint actors which has several dispatcher events like “OnPlayerClicked”, “OnAnimationFinished”, “OnPlayerEntered”…etc There are several callbacks in the level blueprint for those actors. The problem is randomly (I could not detect when…) those callbacks are not called… Then I found out that if I press “Compile” on each level/sub-level blueprint then on next play, they get called!
It seems like sometimes callbacks are invalided, somehow!

A quick solution maybe a tool to re-compile all maps’ level blueprints.

This happens randomly and quite frustrating. I can foresee it will result in nightmares when our project gets bigger and new maps are added. Since you won’t know then your events won’t get called. Player would click a hotspot and nothing will happen!

Thank you in advance for your responses,
Best,

Galip

Hi ,

  • Currently it is limited to one project. I suspect this problem occurs with complex blueprints and code size.
  • There are no specific steps to reproduce it. I think it is related to initial value reset bug which is still happening with cyclic references with blueprints inheriting each other. And I am using inheritance with my base blueprints.
  • The problem is, engine completely ignoring blueprint callbacks/events. Since they are not called, there is no opportunity to put breakpoints and check values. Those ignored callbacks/events are all added from editor, by right-clicking blueprint actors and selecting “Add Event” option. So editor creates and places them into the level blueprint…
  • Good thing is this problem can be resolved by pressing “Compile” manually on every level blueprint.
  • The bad thing is you don’t know when it will happen next…

Hi ,

  • Does this occur in a clean, blank project with no additional content or is it limited to one project?
  • What steps can I take to reproduce this on my end?
  • Have you tried adding IsValid checks before the functions are utilized to see if any are registering NULL values?

If you have any circular dependencies, try breaking the circular reference to see if the error stops. In general it is not recommended to have any circular dependencies within a project, as this can cause numerous errors, especially when using blueprints. Break these and see if the error still occurs.

Are there any tips to detect circular references and resolve them? Breaking them sounds like to change the way blueprints interchange data and call each others events and functions…

unfortunately no, this is a manual process. But you are correct, you will need to re-write the segment of code forming a cyclic dependency to form a more linear interaction.

We are using full blueprints for game logic and mechanics. Do Epic have a tutorial to avoid circular references or minimize them? This thread clearly states that they are unavoidable, and reflects my situations as well:

Hi ,

Unfortunately the information in that thread is slightly misleading. Avoiding a circular reference is tricky, but manageable in the vast majority of cases. The problem with them lies in that a blueprint “up the chain” of blueprints referenced requires functionality from another blueprint “down the chain” to be able to run a function needed “up the chain”. This is, in general, bad coding practice. We try to avoid this as much as possible because it often leads to errors with bad calls, compilation problems, re-referencing errors, etc. There have been a number of fixes implemented to try and get the editor to work more with circular dependencies, but this is a bandaid over the initial issue, which is the dependency itself. At times it is completely unavoidable, but this is few and far between and alternative solutions should be sought first before relying on a cyclic dependency, as stated above this will lead to more problems than solutions.

At present we do not have a tutorial on avoiding/minimizing circular references. One way to avoid this, though, would be to separate what functionality is being called by each blueprint. Intercommunication is perfectly fine, as long as the information one blueprint is not required to immediately run functionality in another. For instance in that thread you linked, mentions a HUD blueprint searching for inventory information while the player searches for references to the HUD. These can be separated so that the HUD is called in the player using “Create Widget”, when the widget is created, it does not immediately gather the inventory information, instead it calls that function only when a custom event is called to show the inventory screen. This gives the same functionality as before, but breaks it up so the two actors are not cyclically dependent upon one another.

Hi ,

We have not heard from you in several days. I am marking this as answered for tracking purposes. If you are still experiencing this error after fixing the cyclic dependencies, please post back here and I’ll be happy to take another look.

Hi ,

Thanks for clarification, but it looks like we will need to re-write all the big blueprints we have built far. Considering we are in full-production now, we will have to go on like this… I wish the engine had a scripting language support for C# or Java. This way, blueprint development related problems like this would never exist… But every choice has ups and downs. We chose UE4 for great visuals and we will keep using it…