Unreal Snippet: UObject Validation

Unreal Snippet: UObject Validation

Created
Jul 26, 2021 2:52 AM
Tags
BlueprintsSnippet

Confirming that a UObject is valid is an important aspect of Unreal Engine development. If you attempt to manipulate or use the UObject while it's invalid, you can come across issues. And in more severe cases, engine crashes.

There are multiple methods on how to approach this —-

icon

If you end up finding this article useful — spread the word!

Method #1 - Is Valid Macro

This method is a built-in macro that outputs an IsValid and an Is Not Valid execution path. Useful what occurs based on if the UObject is valid or not.

image

Method #2 - Validated Get

This method is more of a hidden method that a lot of Unreal Engine developers haven't stumbled across yet. It basically combines a given Variable with the above Is Valid Macro. Extremely useful for cleaning up blueprint layouts.

image

To convert a Variable to a Validated Get —-

  1. Right click variable node
  2. At the bottom of the right-click action menu, click Convert to Validated Get

image

Method #3 - Is Valid Getter

This method returns a Boolean that states wither the UObject is valid or not. Useful when batching together multiple arguments.

image

icon

Thank you for reading!

My goal with Unreal Directive is to provide an extremely useful and easy to understand resource for Unreal Engine developers across all skill levels. Therefore, if you have found this article useful, spread the word! Please share it with your developer friends and peers. If you have a suggestion, or have come across an issue with the article, please message me via Twitter or via email.

Thank you,