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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Packaging fails to package widget blueprints referenced from code

Hi,

repro steps:

1) Create new project based on "first person" c++ example. 2) In content folder create widget (AddNew->UI->WidgetBlueprint) and name it W_UnitWidget. 3) Open VS, and go to [ProjectName]Character.cpp file. 4) In constructor at the end add this code:

 static ConstructorHelpers::FObjectFinder<UBlueprint>MyObj(TEXT("WidgetBlueprint'/Game/W_UnitWidget.W_UnitWidget'"));
 if (MyObj.Object && GEngine)
 {
     GEngine->AddOnScreenDebugMessage(-1, 14.f, FColor::Red, "widget found");
 }

Remember to put aproppriete widget reference in MyObj contructor.

5) Compile. After hot reload hit play in editor or play in standalone widow. Debug message "widget found" appears. Our widget was properly foun. 6) Go to File->Package project->Packageing settings. Check "Full rebuild" 7) Package project (File->Package project->Widnows->Windows 64 bit) 8) After packageing is done go to packaged project and run game 9) Game will prompt that W_UnitWidget was not found

cheers

Product Version: UE 4.9
Tags:
more ▼

asked Sep 23 '15 at 09:01 PM in Bug Reports

avatar image

BujakD
212 15 23 32

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

1 answer: sort voted first

Hi Buyaka,

Thank you for pointing this out to us. I was able to reproduce what you described using your repro steps (very clear, thank you!), and have submitted a report of my observations to have this investigated further (UE-21466).

Tim

more ▼

answered Sep 24 '15 at 07:15 PM

avatar image Nick Darnell ♦♦ STAFF Sep 29 '15 at 02:24 PM

Not a bug, the WidgetBlueprint is an editor only class. You can tell because it's in a module in the Editor directory. UBlueprints should've been and hopefully will in the future. You need to reference the generated UClass instead, the "_C" object that's generated when you compile a blueprint, instead of the WidgetBlueprint. e.g.

"Class'/Game/W_UnitWidget.W_UnitWidget_C'

avatar image BujakD Oct 02 '15 at 10:46 AM

Hi guys,

thanks for Your answers. Hmm.. I think I have found similiar problem, this time with regular blueprint (not UserWidget). Repro steps are almost identical:

1) Create new project based on "first person" c++ example. 2) In content folder create blueprintt (AddNew->BlueprintClass), inherit it from Actor and name it BP_MyBP. 3) Open VS, and go to [ProjectName]Character.cpp file. 4) In constructor at the end add this code:

 static ConstructorHelpers::FObjectFinder<UBlueprint>MyObj(TEXT("Blueprint'/Game/BP_MyBP.BP_MyBP'"));
 if (MyObj.Object && GEngine)
 {
     GEngine->AddOnScreenDebugMessage(-1, 14.f, FColor::Red, "blueprint found");
 }

 

Remember to put aproppriete widget reference in MyObj contructor.

5) Compile. After hot reload hit play in editor or play in standalone widow. Debug message "blueprint found" appears. Our widget was properly found. 6) Go to File->Package project->Packageing settings. Check "Full rebuild" 7) Package project (File->Package project->Widnows->Windows 64 bit) 8) After packageing is done go to packaged project and run game 9) Game will prompt that BP_MyBp was not found

conslusion is that this issue is not limited to Widgets but to all blueprint classes. Most likely the problem here is that code posted here is executed very early and engine maybe not initialized at this point. If I move this code to other consttructor that runs AFTER begin play event it works as expected.

cheers

avatar image Tim C ♦♦ STAFF Oct 02 '15 at 04:08 PM

This is the same result that Nick mentioned. If you instead use the generated class, everything should work fine.

static ConstructorHelpers::FObjectFinderMyObj(TEXT("/Game/BP_MyBP.BP_MyBP_C"));

Tim

(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