Why I Use IsValidLowLevel
Hi there!
First of all I want to say to CMartel that I appreciate your presence in the forums, and I have been very happy to see you helping so many people!
I did not use IsValidLowLevel() due to lack of documentation, IsValidLowLevel() was the only thing that made my Beta in-game Editor stable as I was frequently destroying and creating UObjects at runtime from user-input.
Below is a video of my in-game editor where I make a Blood Cell Galaxy in about 8 min using my in-game c++ tools!
**Red Blood Cell Galaxy Video**
The video demonstrates my in-game editor's undo-redo feature which has infinite storage capacity!
I also demonstrate my multi-selection system, and copy-pasting and translating/rotating/scaling of whole groups of actors.
All of this is done with the UE4 editor closed, and my levels are saved to hard disk and can be loaded any time using custom serialization code :)
In this UE4 Beta project I essentially made my own c++ level editor that I could ship with my game and people could share their own levels using my custom file format.
https://youtube.com/watch?v=1vCToatFbHI
IsValidLowLevel()
While making my in-game editor, I encountered cases where a UObject pointer was still valid, but its internal data was partially deconstructed already, as I was dynamically spawning and deleting actors quite frequently (its an in-game editor after all).
In this circumstance, doing a simple pointer check was insufficient, and my game was crashing because the interior UObject data was already partially destroyed but the pointer was still valid.
I found that IsValidLowLevel() was the only way to verify the full integrity of the UObject.
I agree that in many cases this extra check is not necessary!
You should use your own judgement as to whether you feel IsValidLowLevel() will help you or not.
The main thing you can take away from this post of mine is that if you ever get inexplicable crashes with UObjects using only simple pointer validity checks, you should certainly try out IsValidLowLevel()
Ever since my experience during the Beta, I chose to always be as safe as possible and do IsValidLowLevel() checks.
I’ve had cases where doing this extra check has helped in multiplayer games with replicated proxies being passed via Server function, and people besides myself have also encountered this.
However I agree it is not the majority case or even a common experience, so you should feel free to use your own judgement about whether IsValidLowLevel() is a required check.
**4.7**
Furthermore, the UObject improvements in 4.7 might have removed the cases I was encountering from the Beta, I am not sure yet whether this is so due to lack of time testing 4.7.
**Summary:**
Use your own judgement!
I showed the safest possible case in my wiki tutorials, but please use your own judgement as to whether IsValidLowLevel() will benefit your game as an extra stability check.
It is a minority case that can still crash your game, so that's why I include the extra safety check in my wiki tutorials.
Enjoy!
Rama