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"

AnswerHub Maintenance

Background maintenance is scheduled to occur between 9 - 11am EDT on Tuesday, May 21. Site operation may be slower than normal during this time and a brief interruption in operation may be observed

Cast failing when it should not

Please check this screenshot:

alt text

This results in "Cast Failed". But, as you can see, I am trying to cast to VerticalBoxSlot and it is a VerticalBoxSlot.

Anyone knows why is this failing?

Product Version: UE 4.16
blueprint.jpg (174.5 kB)
more ▼

asked Jul 23 '17 at 06:27 PM in Blueprint Scripting

avatar image

Marcio Daniel
495 16 33 100

avatar image Ego Studio Mar 18 '19 at 05:57 PM

How did you create "container" and "slot" widgets : by adding directly on widget editor or calling CreateWidget and promote to reference ? The failure possibly comes from validity even if it seems to have a value (if you added directly on widget editor).

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

You are getting the wrong slot and you don't need to cast. Just tested this out and it works fine. As for the "Is Valid", did you add your widget to the viewport?

alt text

alt text

alt text

more ▼

answered Mar 19 '19 at 01:32 AM

avatar image

Nebula Games Inc
4.9k 27 9 14

avatar image CinnamonSouls Mar 19 '19 at 04:04 PM

I was running my init script before adding to the viewport, I didn't realize things weren't valid until adding as a child or whatnot, I thought constructing was enough. Thank you so much! You have saved me a lot of time.

avatar image Nebula Games Inc Mar 19 '19 at 10:30 PM

No problem. Glad to help.

(comments are locked)
10|2000 characters needed characters left

Hello Marcio Daniel!

You have to get the slot of the child, not the container.

more ▼

answered Jul 23 '17 at 08:07 PM

avatar image

1k 17 8 15

avatar image Marcio Daniel Jul 23 '17 at 10:43 PM

Nope. Sorry, I see now that the name of the variable can cause this confusion, but the blueprint is correct: these "Container" variable is also child of another widget, and I actually want to get it's slot.

But none of that matter: if you see the white box, it's showing the current value of the slot while I was debugging. It shows a VerticalBoxSlot. So why the cast is failing?

avatar image CinnamonSouls Mar 18 '19 at 03:56 PM

DId you ever figure this out? I am having the same issue. Casting to a slot that it apparently is, is failing.

avatar image Marcio Rosa Mar 18 '19 at 05:42 PM

Sorry, but no, I didn't. I had to change the approach to get the result I wanted because I never figured out how to solve this.

avatar image Nebula Games Inc Mar 18 '19 at 07:41 PM

@CinnamonSouls post screen shots of your set up. This shouldn't be hard to figure out. I would comment on the original screen shot but I need more info before I can really tell what the issue is. "Container" and is what type of variable exactly? How is it setup in the widget hierarchy etc. So instead of trying to fix an old issue, post your current issue along with a general "goal" of what you are trying to accomplish and we will go from there.

avatar image CinnamonSouls Mar 18 '19 at 10:23 PM

Below are my screenshots. I have the Text Size Box as a child of the overlay. You can see that it's a variable and a valid overlay slot. You can see where I cast it to overlay slot and set padding. You can also see where I test to see if the variable is even valid. According to the logs, it's not!

alt text

alt text

alt text

alt text

(comments are locked)
10|2000 characters needed characters left
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