How to cast an object to its interface using Blueprint Scripting?
I can't cast my GameState blueprint to IGameClock (the interface it implements). This is preventing me from passing my GameState object to an "exposed on spawn" class variable of type IGameClock.
Here's an overview of my blueprints:
My GameState blueprint (BP_GameState) implements my IGameClock blueprint interface. (See below)
GameClockHud is a child of UMG.UserWidget, this widget's only responsibility is to display the game clock (Month, Date, Hour, Minute, etc.). On class spawn/construct I want to pass it an instance of my BP_GameState that implements IGameClock, but I would like the variable type to remain as IGameClock. I don't want the widget to worry about what the concrete object is called, just that it implements IGameClock. (See below)
I attempt to create a new instance of GameClockHud in the MasterHud event graph, but I get compiler errors because UE4 can't cast BP_GameState to IGameClock (it doesn't even provide me any nodes to do this).
asked Jun 02 '16 at 04:12 AM in Blueprint Scripting
Turn off Context Sensitive and the Cast_To_IGameClock will appear.
Have Fun =)
answered Jun 02 '16 at 04:35 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here