I have a custom widget, CompassIcon, that I want to dynamically add to the HUD (i.e., UMG). This can potentially represent an objective or an enemy or something else, so they could be several. I want each type to be a different letter and colour, so I set up an interface for objectives, enemies, etc. to use, and have CompassIcon store a link to the actor as the interface object.
CompassIcon just contains a text widget. I am setting colour and text as bindings. Setting the text is fine. I have only tried one at a time, but the correct text shows. The colour is okay if I use a literal value in CompassIcon, but if I try to access the value in the linked actor - which is also a literal - it crashes.
My blueprint checks that the linked actor is not null (IsValid), and prints to screen if not. If there is a linked actor, it calls the function to get the colour. Note that in this configuartion, it does nothing with the colour, just returns a literal. This crashes UE4. If I have it skip the get colour step, no crash.
For what it is worth, here is the blueprint in the linked actor:
I am at a loss as to where to go from here.
I could not find anyway to check if the slate color is valid or to convert it to a string so I can print it and see it.
Here are the last few lines of the crash log. I added a 3 second delay so the widget gets added after the start, just to make sure everything has been initialised, so only the last two lines are from the crash. Objective_One is the objective, the linked actor, and CompassCanvas is a panel widget that the CompassIcon is added to. FPS_HUD_BP_C_7 is the HUD object. As far as I can see, this is no help at all!
[2018.05.09-17.40.04:024]LogBlueprintUserMessages: Late PlayInEditor Detection: Level ‘/Game/ThirdPersonBP/Maps/ThirdPersonExampleMap.ThirdPersonExampleMap:PersistentLevel’ has LevelScriptBlueprint ‘/Game/ThirdPersonBP/Maps/ThirdPersonExampleMap.ThirdPersonExampleMap:PersistentLevel.ThirdPersonExampleMap’ with GeneratedClass ‘/Game/ThirdPersonBP/Maps/ThirdPersonExampleMap.ThirdPersonExampleMap_C’ with ClassGeneratedBy ‘/Game/ThirdPersonBP/Maps/ThirdPersonExampleMap.ThirdPersonExampleMap:PersistentLevel.ThirdPersonExampleMap’
[2018.05.09-17.40.06:862] 65]LogBlueprintUserMessages: [FPS_HUD_BP_C_7] Objective_One
[2018.05.09-17.40.06:862] 65]LogBlueprintUserMessages: [FPS_HUD_BP_C_7] CompassCanvas
(I am only just learning UE4, but have a fair bit of experience in other languages. I am using 4.19.2)