Need Help Getting info from a spawned widget

Hi guys!

I’m very very new to gamedev and i’m trying to make a very simple cardgame. i’ve managed to make my card widget and to spawn my hand and a “opponent” card as if that was just played against me. My issue is that i want to get the variable from the opponent card to compare it teh card i’m using and check which one is higher.


i’ve set this up so that when i double click i check the value from the card i’m playing with the card that’s on the opponent side of the board. is there a way for me to gat that value and compare it here?

just to give some more details, i just simply have one card spawn in the opponend square and 3 cards in my “hand zone”.

thanks to everyone that’ll try to help me! i’ve watched 25 tutorials but i cant seem to understand how to do this :frowning:

Use “middle man” setup for all that.
In your case middle man should be one of those:

  • game mode (easiest to get, simple in non multiplayer games)
  • BP_HUD, create hud , it is logical widgets report to hud
  • player controller, or they report to it
  • player pawn. player character, same as above

When you pick your middle man, create there CUSTOM event, like “Widget did something”

Then in widget get reference to middle man (easiest is to get game mode), cast to BP_GameMode , then trigger event there, pass over variables from widget.

In case of game mode, make sure its set in project settings to your game mode, and all stuff in it is set to whatever you want to use as defaults in your game.

1 Like