so I asked about using integers in other bp widgets in [here][1] and had another question but when I’m trying 2 reply there, the site states that I’m logged out o,o anyway, some1 told me that I need 2 do that:
-.- so if “get player controller” is the problem, is there any other castable thing where I can connect my int and have object output so I can connect it 2 cast that could work? or some other solution if not? o,o
You can only cast to another class which is the parent of your object’s class. Obviously. You can cast an Animal to a Dog if you know it’s a Dog, but you can’t cast a Duck to a Streetlight - they are irrelevant to each other. Here you are casting PlayerController to some UI, which is not a PlayerController for sure. You have to cast it to your own PlayerController class, and get the Score out of that.
PS: Your Score is not an int, it’s an object, as it’s blue. Integer would be green.
ue4 says that integer is cyan and get score on the left is cyan but it passed thru player controller and it turned blue on the other end so from what I see here I need 2 make child class 4 the ui and make it so it would have int on the left and object on the right 2 use it instead of the player controller bc my goal is 2 use the score in the ui I will try 2 do that somehow…
If you want to set the widget display of score to the player character score (int) value this is very very wrong. You need to get the score from the player (int), pass the score value to your widget through a reference to the widget. Pull whatever text or display you are trying to update and set that value to the integer value of player score. You are using the “score” to “get” a specific index of a UI array to then cast the UI to a UI object which makes no sense and then set a variable called “score” which is actually a reference to a UI actor to the UI you cast the from the “get” node. Not to mention the first “score” variable isn’t even connected (white execution pins) so it won’t return anything.
I have a couple videos that may help you understand what everyone here is trying to say. The first one in the list is all about casting, the last one is about making references. I think those 2 would be most helpful to your current situation.