Skip to main content

Register New Data Type

info

All information below is for blueprint-use. Where relevant (New class, variables, sorting, etc) you can use the C++ equivalent of it.

Asset

Create a new child blueprint of EncyclopediaDataAsset_Custom anywhere in your project.
In the class defaults set the Primary Asset Type Name to something you'll remember for the AssetManager section of this guide.

Variables

You can create any variable in here that you want this custom data type to have.

Sorting

To sort your data type in the EncyclopediaSubsystem implement the function CompareTo. In there you can compare the results.
Use your own data of the DataType with the data of another instance of the DataType and compare the results. Returning true means that the result will be higher in the list than the other.
We supplied a CompareText function for you to easily sort based on names.

Asset Manager

You will need to register this data type in the AssetManager in Project Settings -> Asset Manager -> Primary Asset Types.
Add a new entry and setup the data similiar to the other entries, or follow the official Unreal Engine documentation. The Primary Asset Type name should be set to what you set in step one.

Widgets

Create two new widgets in your content browser. They should both be of type EncyclopediaDataWidget.
Implement Event Apply Data Asset and cast to your custom DataType and use the data of that type to setup your widget.

You will want to design one Button and one Widget that displays the data of the DataType.

Register

For info on registering a new UI component, go to Register UI Component.