Make Blueprints null references crash and display log

Like in c++ with check(), sometimes we do not want something happen, and blueprints are very soft in this cases, I do not like only the message inside the editor, I would like a full and powerfull crash in the very moment that my logic failed, please

Salut a tout le monde

Engine should never crash if game’s logic fails. Simply because it wastes a lot of time for person who experiences crash. And if this person isn’t a programmer/scripter she would have idea what and why happened. Occasionally that person looses lot of work because somebody made a mistake in code long time ago. It can be incredibly annoying in case of frequent crash. And it’s never guaranteed that “author of bug” can fix it ASAP.
Also, undetected null reference would crash a game for person who bought the game. And that’s one the worst things, right? :wink:

Stability is one of the best features of “managed environments” like C# in Unity or blueprint in Unreal. It should be always a priority :slight_smile:

@**kjustynski , **I am not discussing about a final product, for obvious reasons you cannot package a game with potential crash errors, I am speaking about development only, I am experimenting that my team very often left small problems persists, only because unreal only sent warnings, this a full warranty for more errors in future, I consider this like a helper to encourage people fix errors quickly and localized, check nulls is a common practice in c++ and bad managment usually means something really wrong!

In any case I am posting my experience with my team (some of them really new with the engine, which is what epic wants, I believe, “expansion”), just to be consider by the community, I did the proper changes to our engine version to make this possible for us, and then I will be able to tell my experience and say if this works or not


I really don’t think you actually want to do this, but you could change FBlueprintCoreDelegates::ThrowScriptException to check() on EBlueprintExceptionType::AccessViolation, or hook it yourself (add a delegate to FBlueprintCoreDelegates::OnScriptException and do the check() in game code land). As kjustynski metioned, crashing the editor due to buggy game code is incredibly aggressive; the user will lose any unsaved work they were doing and ideally should be avoided at all costs.

More practically, you can enable the experimental feature ‘Blueprint Break on Exceptions’ in the editor settings, which will treat access nones like a BP breakpoint.

Michael Noland

You can also set DurationOfErrorsAndWarningsOnHUD to a value greater than zero to get on screen error messages during PIE when things like access nones happen (they look the same as messages like ‘unbuilt lighting/HLODs’ errors), this helps make it more obvious while iterating on content (and ties them temporally to your or the AI’s recent actions) without having to always go look at the log. Engine.SupressWarningsInOnScreenDisplay controls whether both errors and warnings are displayed or only errors.

Michael Noland

Hi Michael, yes I think I was misunderstood, my intention is not crash the editor, only the running game instance, the think that you describe with the Blueprint Break on Exceptions is exactly what I meant, and I didnt know about it, I will remove my approach and I will use that instead, pretty sure it will help a lot, thanks

It’s great for sure. It should probably be ticked by default so people don’t get confused when things don’t work. :rolleyes: