PhysicsSurfaceMaterial as a key for TMap

WHSolv
Sat, 13 Jul 2019 06:45:54 +0000
World Creation

Yo, folks.

Plot

I want to have a static TMap of physics materials and their corresponding impact particle and sound cue that could be set-up in Editor. Like in ShooterExample but in a more intuitive and elegant way, i.e., w/o switch-cases and preprocessor macros.

Debugging

I have already understood how to initialize a static TMap within a class’ namespace. So I have the following variable in my AActor-inherited ImpactFX class:

UPROPERTY(EditDefaultsOnly, Category = Content)
TMap<TEnumAsByte<EPhysicalSurface>, FMaterialImpactData> Data;

I have one extra physics surface material (Snow) as shown on the image below.

However, in the Blueprint, I only have Default physics material, and cannot add any more entries (since [seems like] the engine doesn’t hook the rest of the materials).

How can I achieve that all the Editor-created physics materials could be used as keys for the initial variable? I have a suggestion that I have to use another type (one of the children) as a TMap key.
1 post - 1 participant