How to display custom class as property in data asset?

I am creating a simple RPG game which uses dice rolls to determine weapon damage (eg. 2d6). I created a custom class RollValue which has two member variables:

  • (int) rolls
  • (enum) dice type

I also have a weapon data asset class called Weapon (inherits from UDataAsset) which contains a member variable of type RollValue.

  • (string) item name (eg. “dagger”)
  • (int) gold value (eg. 2)
  • (class: RollValue) damage roll (eg. 2d4)

When I create a data asset such as “dagger”, I would like to be able to see the variables of the RollValue of the Weapon data asset. Unfortunately, I’m unable to do this since UPROPERTY does not work with custom classes.

How would I go about making the RollValue class drawable inside the weapon data assets?

You can use USTRUCT instead of custom class, or derive it from UObject and Mark as UCLASS. Do you have a special case to use custom class?

Thanks! USTRUCT seems to do the trick.

I mainly wanted to use this RollValue to then make a special drawer for so that I can display it inside a data asset without having to unfold the property to reveal these two variables. Ideally, the custom drawer would then just display the int value with the enum value to the right of it on one line.

Also, this RollValue will be used a lot inside the C++ code since it contains some functions to actually roll a random value or get an average based on what kind of die and how many rolls.