Set Input Mode Game and UI errors

Hi there again :wink:

First have a look at this if you dont believe me.

Second you try to cast upwards. A child into parent which is not meant to be. F.e. a vehicle can be a car, this is valid because the car can do everything a vehicle can. But a car cannot be casted into a vehicle, because there are variables, functions only a car can.

Your point: “returns a UserWidget reference” is right because your custom created widgets are always children of a UserWidget. If im wrong then the print string “Casting Failed” should not be executed on your screen.

As for my mentioned steps, have you disabled the logic you do in levelbp and ProtoHUD? i forgot to tell you that.

Next: you called your PlayerControllerBP: PC_EdgeScrolling? why? is there another PlayerControllerBP somewhere?

However i thought about that create widget stuff. When you create a Widget you give it a reference to the owning Playercontroller. Assuming your RTS will be a multiplayer later, its good to have the creation still inside PlayerController, it would have the effect that every instance of a PlayerController (player 1, player 2, player 3) will have its own widget to deal with. If you leave it in levelblueprint having more than one player, you would need to add a function which creates multiple widgets for each playercontroller.

For not having a reference to your created widget. This could be a problem when you want to hide your widgets. F.e. if you need that in a cutscene. Saying this does not mean you will have to do it this way, there can be other ways too.

Just to have mentioned it, the input mode just works fine in my projects.

  1. Disable every logic you have done so far regarding your UI
    or try it in a raw project.

  2. Create widget in PlayerController

  3. Add it to Viewport

  4. Setup Input Mode

  5. No logic inside your WidgetBP

when im home i can make you an example bp