Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Use BP Enumeration asset as UPROPERTY in c++ class


I am trying to attach a BP Enumeration asset to a custom c++ class in a way that will expose it within the editor.

However, I'm running into a lot of trouble. I'm able to attach the asset as a UEnum*. However, it doesn't give me the dropdown of the elements like I wanted when I place the blueprint(from the c++ class) within the editor. It only gives me the UEnum object itself.

I'd like to use a BP Enumeration over a c++ one for ease of access. I don't need to make any changes to it within the c++ code, I just need to editable within the editor. I also want to make it an array, but I'm assuming I just have to figure this out, then put it in a TArray<>.

The c++ class inherits from UStaticMeshComponent. For some reason, this doesn't let me generate a blueprint from it, so a cannot at the Enumeration there.

Here is my c++ code. It's very basic so far: UGameBoard_Tile_SMC.h

 #pragma once
 #include "Components/StaticMeshComponent.h"
 #include "GameBoard_Tile_SMC.generated.h"
 class STRATEGYGAMEV2_API UGameBoard_Tile_SMC : public UStaticMeshComponent
     UPROPERTY(EditAnywhere, Category = "TileStates")
     UEnum* TileStateEnumeration;


 #include "StrategyGameV2.h"
 #include "GameBoard_Tile_SMC.h"
     static ConstructorHelpers::FObjectFinder<UEnum> BPGBCResource(TEXT("Enumeration'/Game/GameBoardAssets/Blueprints/EGameBoard_TileStates'"));
     if (BPGBCResource.Object != NULL)
         TileStateEnumeration = BPGBCResource.Object;

ExecutionCode within constructor of a custom class derived from AActor:

 TileMesh = LoadObject<UStaticMesh>(NULL, TEXT("/Game/GameBoardAssets/Meshes/TileFloor"), NULL, LOAD_None, NULL);
     UGameBoard_Tile_SMC* tile = CreateOptionalDefaultSubobject<UGameBoard_Tile_SMC>(TEXT("Gameboard_Test"));


alt text

Desired: alt text

If anyone can help, I would appreciate it. Again, I don't have to use the actual enumerator within the c++. I plan I using it when I get into the blueprint development side of things.

Product Version: UE 4.8
snip.png (54.1 kB)
desired.png (7.4 kB)
more ▼

asked Aug 01 '15 at 11:13 PM in C++ Programming

avatar image

6 1 2 3

avatar image shared_pointer Jul 28 '16 at 02:00 PM

Hi, I'm faced with the same problem, did you find out how to do it? Thanks

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question