I’m excited to announce that my Null Coalescing Operator for Blueprints is ready for beta-testing. I wanted to invite a few community members to snag a free copy (so HMU via DM if you’d like one).
This is something that I’ve wanted for a long time in my own blueprints. This year, I’ve finally carved out some time to develop some of my UE4 (micro-)tool wish-list.
I’ve posted in-depth documentation here, but here’s a quick summary:
The Null Coalescing Operator returns the first of its given inputs that is not null.
So, if you want to say “if I have a shield, then the shield should receive damage - otherwise, I should receive damage”, then instead of doing this which is messy:
… or this which is less optimized and more tedious:
… you can use a Null Coalescing operator!
There’s also a Null Coalescing Assignment Operator, which, in short, implements lazy-initialization.
In this blueprint, Spawn Minimap only runs the first time, or after anything else changes the Minimap variable back to null. Otherwise, the Minimap cache variable is used.
Those are just a few examples - there are several more here, and a handful of additional features planned which will add a whole slew of additional use-case patterns. The Null Coalescing Operator certainly isn’t something that I would expect to see used gratuitously throughout a blueprint, but for the specific use cases to which it does apply, it’s a really nice tool to have on hand, especially for those of us who are used to programming languages like C# that have null coalescing built-in.
Questions? Thoughts? Requests? Fire away!