Integer Variable to keep score(Cant get it to work i think it is a casting issue idk?)

Hey so this is my approach, feel free to ask whatever i guess ^ ^ :).

What does not work?

Your widget is not updating the score on screen?

From what I see it’s all correct.

Here’s the culprite nodes to me:

  • maybe your “OnComponentBeginOverlap” event does not fire, try adding “Print to String” nodes to see where the execution fails
  • your “cast to” might fail if the actor overlapping is not a PlatformCharacter, try adding “Print to String” nodes to see where the execution fails
  • maybe you’re not using your “Scoretext” variable in your widget: try to see if you actually do something with this value
  • or ScoreWidget is null (it’s an object that hasn’t been created or a variable that hasn’t been assigned yet) - but it would prompt an error in your log
  • everything works but the widget “ScoreWidget” might just not be displayed on screen - did you “Add to player screen”?

Be sure to always attach something to the Cast Failed node when developing - it will save you lots of time. Just put a Print String that says “Cast Failed” - and you will know right away where the problem lies, if that is where the issue is.