I decided to start a new series of bite-sized game development tips called Quick Dev Tips. I want to share quick tips, tricks and advice that I pick up on my game dev journey. For now predominantly focusing around the Unreal Engine 4, hitting up all areas; blueprints, animation, UI, sound, optimisation etc.
This first one is about an easier way to is valid an object reference. It’s what sparked the idea for this series. If you would prefer to watch the video, check it out here: https://youtu.be/8Bso2-cRYUk
#1 UE4 - Blueprints - is valids
I’m always trying to keep my blueprints clean and organised, so just like good code, it’s easier to come back to in the future and understand what is going on. After I found out about this trick I started to use it all the time which is why I wanted to start with it.
Its good practice to is valid an object reference (something that’s far more important to check in C++) to make sure the object exists/has been set.
Normally you could do this in one of two ways. Using the is valid node with a true/false return or the is valid node with a bool return which you could then branch off.
However, there is also a third way which is much cleaner and doesn't require any extra nodes. If you right-click on the out of an object reference variable. Then you are given the bottom option: Convert to Validated Get. Clicking this turns the variable into a non-pure version which has true/false out pins built directly into it. So now you can use the reference directly without needing any extra nodes, clean and tidy!
If you want more tips and tricks make sure to give me a follow on Twitter @cbGameDev