Data Scraping Using Reflection
- Jeremy Baldwin

- Jul 27, 2024
- 2 min read
Updated: Aug 24, 2024
Overview : Written in UE5.4
In this article, we will look at realtime object inspection through the lens of editor tooling. In certain circumstances, it is important to interact with an object's state to verify information, be reactive to changes, simplify serialization, build unique hashes, filter, etc. UE5's Reflection System affords us the ability to do just this. And while Reflection is a road less traveled (with a fairly steep learning curve), this exercise will hopefully shed some light on the subject.
Result
Logging system auto populated by Reflection inspection of UObject properties
Let's Begin
Step 1: Plugin Module Structure
The plugin is in large part boiler plate apart from a few additions which are outlined in the following prerequisites section. The bulk of work occurs in DSUtilities after object reference(s) are provided by the editor via a custom Editor Subsystem. The object's properties are then scraped, interpreted and logged.
Step 2: Prerequisites
Open the .plugin file and switch type from Runtime to Editor:
Open the Build.cs file and match the following private dependencies
Step 3: DSUtilities .h/.cpp
The DSUtilities source file implements what we will call Property Inspection. Follow the code comments for breakdowns, notes, and suggestions.
DSUtilities.h
DSUtilities.cpp
Step 4: DataScraperEditorSubsystem .h/.cpp
The DataScraperEditorSubsystem source file implements a custom Editor Subsystem which is registered automatically. Follow the code comments for breakdowns, notes, and suggestions.
DataScraperEditorSubsystem.h
DataScraperEditorSubsystem.cpp
Step 5: Build and Run
Build the project and run the editor. Once the project is loaded, make sure the Output Log is visible by navigating to your menu bar and choosing Window > Output Log. Once open, expand it horizontally to provide a decent amount of room. Select an object in your scene such as a light actor, skeletal mesh actor, static mesh actor, etc. and run the following command to achieve the result seen at the top of the article.
DataScraper.LogSelectedObjectProperties
Additional References