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"

BindWidget, OptionalWidget and class mismatches

  1. Create a C++ subclass of UUserWidget, let's call it UCrashTestWidget

  2. Add a property marked UPROPERTY(meta=(BindWidget, OptionalWidget=true)), with type UOverlay (or anything). Give it name MyContainer

  3. In the Unreal editor, create a Blueprint subclass of UCrashTestWidget

  4. Inside the widget, create a widget that is not a UOverlay, but call it "MyContainer"

  5. Run the game. Notice: MyContainer is not null but it is not initialized correctly.

This seems like a dumb error, but I spent 20 mins wondering why today. I had another widget in my hierarchy named the wrong thing, and was getting a crash in C++ because of badly-initialized classes.

I would expect an error (or at least a warning) if the widget in my Blueprint does not match the expected BindWidget type.

Product Version: UE 4.16
Tags:
more ▼

asked Jul 03 '17 at 10:55 AM in Bug Reports

avatar image

benhumphreys
118 16 24 33

avatar image Doug E ♦♦ STAFF Jul 03 '17 at 01:09 PM

Hey benhumphreys-

Can you elaborate on what you're doing in step 4? After creating the blueprint and adding something to it (button, canvas Panel, border, etc), any attempt to change the name to "MyContainer" will revert to the previous name. This happened when trying to rename it from the details panel or directly from the Hierarchy.

avatar image benhumphreys Jul 03 '17 at 01:55 PM

Sorry the exact behaviour I did was:

  1. While the UMG Widget Blueprint class is a sublcass of UUserWidget, create a widget that is not an UOverlay, called MyContainer.

  2. Reparent UMG Widget Blueprint to UCrashTestWidget

  3. Run game, notice that MyContainer is not-null, but not a valid UOverlay (as expected, it was initialized from another type of widget).

I assumed the same thing would happen if I created the widget from scratch, but actually the wrongly-typed (and conlictingly-named widget) already existed, when I reparented the widget...

I realise it's quite a niche bug, now.

avatar image Doug E ♦♦ STAFF Jul 03 '17 at 02:58 PM
  1. Created blueprint based on UserWidget

  2. Add button

  3. Change button name to MyContainer

  4. Reparent blueprint to CrashTestWidget

At this point the blueprint had a compile error due to the name conflict and as a result would not successfully compile. Changing the name of my button produced the results I mentioned previously. If you're able to reproduce the crash locally, could you provide a small sample project that demonstrates the crash?

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

1 answer: sort voted first

Hey benhumphreys-

We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will follow up.

Cheers

Doug Wilson

more ▼

answered Jul 10 '17 at 05:22 PM

(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