x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

bp casting - object reference is not compatible

so I asked about using integers in other bp widgets in here 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: alt text

howevr when I'm trying 2 do that, cast doesn't want 2 connect with the object I made saying that it's not compatible: alt text

could some1 pls tell me what's the problem with that?

Product Version: UE 4.21
Tags:
ue4ss4.png (65.8 kB)
more ▼

asked Feb 06 '19 at 10:06 AM in Blueprint Scripting

avatar image

j3lly_m3lly
3 2 3

avatar image j3lly_m3lly Feb 06 '19 at 10:22 AM

upd8: it seems I menaged 2 resolve the problem myself (at least I hope so XD) and "user widget" is the right object type
so I'm fine 4 now

avatar image j3lly_m3lly Feb 06 '19 at 10:28 AM

upd8: nvm, I got warning aftr doing that and ue4 says that cast would always fail:alt text

-.-
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
@Jaydanson

ue4ss5.png (88.1 kB)
avatar image j3lly_m3lly Feb 06 '19 at 11:08 AM

so I'm trying this right now:alt text

it compiled without any warnings so I hope it will b good

ue4ss6.png (69.0 kB)
avatar image Nebula Games Inc Feb 06 '19 at 04:40 PM

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.

https://www.youtube.com/playlist?list=PLyu-W38DvZhqByAoeva1jewB5s78zQHIy

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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.

more ▼

answered Feb 06 '19 at 11:10 AM

avatar image

KristofMorva
1.1k 4 5 7

avatar image j3lly_m3lly Feb 06 '19 at 11:33 AM

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...

correct me if I'm wrong pls

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question