[Resolved] TMap UPROPERTY?


#1

Hey Guys,

I’ve made a new ActorComponent in C++, this has a UPROPERTY that is of TMap<int,AActor*> type. I’m not seeing this exposed in Sk though :frowning: are TMap’s supported? I do see my component in SK, just no class members. Thanks!


#2

Hi Tom - map/TMap support is on our roadmap for this year but as of now unfortunately yet unsupported.


#3

That’s good to hear. I suppose I could just use a TArray with a Struct with the key/value instead?


#4

Yes arrays of structs are supported, so you you could look up an entry by a key field and retrieve its value.


#5

Hmm so I tried that approach, but this is what I’m seeing in !Overlay.sk

$$ LevelDataComponent < ActorComponent
// Level Data Component
//
// UE4 name of this class: LevelDataComponent

$$ @

// &raw List{SpawnLocation} !@spawn_locations_for_wave // Currently unsupported

Do I need to expose the my struct (FSpawnLocation) to :sk: somehow?


#6

Is SpawnLocation itself visible in SkookumScript?


#7

No, I’m not finding it. I did clean UHT and rebuilt from Visual Studio. Here is what the struct looks like:

USTRUCT()
struct FSpawnLocation
{
GENERATED_USTRUCT_BODY()

UPROPERTY(EditAnywhere)
int wave;

UPROPERTY(EditAnywhere)
AActor* spawnLocation;
};


#8

The type int might not be properly supported by UHT - try int32 instead.


#9

Unfortunately that doesn’t appear to have fixed it :frowning: For completion, here is the C++ class:

UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class SHOOTERGAME_API ULevelDataComponent : public UActorComponent
{
GENERATED_BODY()

public:
// Sets default values for this component’s properties
ULevelDataComponent();

UPROPERTY(EditAnywhere)
TArray spawnLocationsForWave;

UPROPERTY(EditAnywhere)
FString name;

protected:
// Called when the game starts
virtual void BeginPlay() override;

public:
// Called every frame
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;

};

I do see that the name member I added is exposed in :sk:


#10

Hey @RabTom, just a shot in the dark here from my USTRUCT experiences. All of my :sk: accessible structs are also BP accessible and they look like so, note the Blueprintable annotation:

USTRUCT(Blueprintable)
struct FClothingStatBonus
{
	GENERATED_USTRUCT_BODY()
	FClothingStatBonus()
		: StatIncrease(0.f)
	{
	}

	// The stat to modify
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Clothing Stat Bonus")
	EClothingStatTypes StatType;

	// The amount to change the stat
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Clothing Stat Bonus")
	float StatIncrease;
};

Also after compiling, check the timestamp on your !Overlay.sk, if it isn’t getting updated then clean UHT and try again. Also, even though TMap isn’t supported, writing a few C++ wrapper functions around TMap would be pretty trivial if you really wanted to use the type.


#11

I’ll look into this some more tomorrow and let you know what I find.


#12

Thanks @error454 I will give that a shot! Also thanks @GreatGuru for looking into this.


#13

For the struct to be available in SkookumScript, you have to currently annotate it with BlueprintType (or alternatively, as @error454 pointed out, Blueprintable), like this:

USTRUCT(BlueprintType)
struct FSpawnLocation
{
GENERATED_USTRUCT_BODY()

UPROPERTY(EditAnywhere)
int wave;

UPROPERTY(EditAnywhere)
AActor* spawnLocation;
};

There were some issues in the past with exposing all structs to Sk so we chose to use only those designated for scripting. Sorry for not seeing this right away! We’ll might in the future find a way to expose structs without requiring this annotation.


#14

Cool, thanks!