Download

Casting problem

Hey! :slight_smile:
I created 2 BP, Player_HUD and Player_Pawn and I need to cast some variables from Pawn to HUD.
So I created these nodes in the HUD BP.

so the problem is that the cast doesn’t working. I don’t have my variables from Pawn in my HUD class BP. :\

Thanks for help! (I’m using UE4 4.4.3)
Yoni

Hello,
If your hud is a bp_hud, check you have set it in your game blueprint.
To have Hud infos in your character do a “Get Player Controller” / “Get Hud” / “Cast to” your Bp_Hud.
To have character infos in your Hud, do a “Get Player Character” / “Cast To” your Bp Character.

I set the bp in my game blueprint.
And the HUD and the Pawn bp are custom bps that I created to RTS camera.
I created it with this tutorial
http://voxagon.blogspot.co.il/2014/07/ue4-tutorial-rts-style-camera-movement.html
and on page 10 you can see the casting.

Pattym just did a template of his rts style camera. You can download it here : https://forums.unrealengine.com/showthread.php?53384-Template-RTS-Style-Camera-Movement-With-Edge-Scrolling&p=187389&viewfull=1#post187389 Then you’ll can compare to your project and / or directly use. As project have been improved, you may find some differences between the two versions of the project.

Thanks. …

Thanks for the direct Fen. :slight_smile:

But yes as Fen as said check out the project template I made. I did make some improvements to the edge scrolling mechanic but you should be able to look through it.

Any how in regards to the issue in your original post… You need to make sure that the “Owning Pawn” is of variable type that matches the Pawn Blueprint you want to allow edge scrolling with. If you look in the tutorial on page 10. The top left image shows the variable type I used in relation to the project which was “Pawn_EdgeScrolling” being the pawn blueprint I created. Doing it this way allows you to get and set variables found in that type of blueprint. :slight_smile:

Hope that helps.

Regards
Michael