Types that you declare in C++ do not automatically get incorporated into Blueprint for use as variables. This recipe shows you how to make them accessible so that you can use custom native code types as Blueprint function parameters.
Create a new class using the editor. Unlike previous chapters, we are going to create an Object-based class. Object isn't visible in the default list of common classes, so we need to tick the Show all classes button in the editor UI, then select Object. Call your new Object subclass
TileType
.Add the following properties to the
TileType
definition:UPROPERTY() int32 MovementCost; UPROPERTY() bool CanBeBuiltOn; UPROPERTY() FString TileName;
Compile your code.
Inside the editor, create a new Blueprint class based on
Actor
. Call itTile
.Within the blueprint editor for
Tile
, add a new variable to the Blueprint. Check the list of types that you can create as variables, and verify thatTileType
is not there...