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"

What's the correct way to load blueprints for packaging ?

Hi,

I am using this routine to load my BP in c++:

 static ConstructorHelpers::FObjectFinder<UBlueprint> BP_d4Object(TEXT("Blueprint'/Game/dice/D4_Dice_BP.D4_Dice_BP'"));
 BP_d4 = (UClass*)BP_d4Object.Object->GeneratedClass;

Doing this for all my BP derived objects.

It works well when launched from the editor, but when it comes to packaged game i get various and seemingly random results (working well / object not spawning but game going on / game crash).

In all cases, the error seems to be an access violation.

So my question is: am i doing this correctly ?

If no, what is the correct way ?

Is there any option i should use in editor or in my code or in the configuration files ?

I have already set bDontLoadBlueprintOutsideEditor=false in the DefaultEditor.ini (and made a request so it's set to false by default when creating a project). Anything else ?

https://answers.unrealengine.com/questions/127212/bdontloadblueprintoutsideeditortrue-by-default.html

Thanks

Cedric

Product Version: Not Selected
Tags:
more ▼

asked Nov 08 '14 at 04:42 PM in C++ Programming

avatar image

uced
825 73 89 360

avatar image uced Nov 09 '14 at 05:29 AM

Edit:

The crash was due to the fact that i was trying to reach a non spawned object.

So the only problem is that the blueprints declared this way won't spawn in packaged game (but this causes no crash).

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

1 answer: sort voted first

Ok, anyone reading this, here is how it should be done, copied from here:

https://answers.unrealengine.com/questions/127212/bdontloadblueprintoutsideeditortrue-by-default.html

It's true by default because Blueprints are not needed outside the editor.

It looks like you're attempting to access the Blueprint generated class through the Blueprint itself. Rather, you should just reference the class directly.

For Blueprint'/Game/dice/D4_Dice_BP.D4_Dice_BP'

The class reference is Class'/Game/dice/D4_Dice_BP.D4_Dice_BP_C'

 static ConstructorHelpers::FObjectFinder<UClass> bpClassFinder(TEXT("Class'/Game/dice/D4_Dice_BP.D4_Dice_BP_C'"));
  if (bpClassFinder.Object)
  {
      UClass* bpClass = bpClassFinder.Object;
  }

more ▼

answered Nov 13 '14 at 06:45 AM

avatar image

uced
825 73 89 360

avatar image acajic Aug 08 '18 at 11:54 AM

When I copy my blueprint reference I get:

Blueprint'/MediaFrameworkUtilities/BP_MediaBundle_Plane_16-9.BP_MediaBundle_Plane_16-9'

I tried loading it like:

static ConstructorHelpers::FObjectFinder mediaBundleFinder(TEXT("Class'/MediaFrameworkUtilities/BP_MediaBundle_Plane_16-9.BP_MediaBundle_Plane_16-9_C'"));

but I still get an error:

Failed to find Class'/MediaFrameworkUtilities/BP_MediaBundle_Plane_16-9.BP_MediaBundle_Plane_16-9_C'

avatar image darkgaze Sep 01 '18 at 05:00 PM

Note you have to add a _C (which is the class name of the blueprint) at the end of the ref!

(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