you can have an interface on the character with some interface functions that return the variable as an output, called something like “GetVariable(variablename)”.
Then the widget only needs to GetPlayerCharacter → GetVariable and then you have access to that variable without having to cast directly to the actor.
If you are wanting to communicate with some actor other than the playercharacter/playerpawn, you might need another way to identify it.