uced
(uced)
November 2, 2014, 4:50pm
1
Hi,
This is not technically a bug but i think it should be corrected nonetheless.
I opened (and closed) this thread:
Hi, My game works fine in the editor (even when launched as a standalone game). But when i package it, i get a crash with a message pointing to those lines in my code: // Dice declaration static ConstructorHelpers::FObjectFinder...
because i got systematic crashes with a packaged game (which worked fine in the editor) when using declaration such as:
static ConstructorHelpers::FObjectFinder<UBlueprint> BP_d4Object(TEXT("Blueprint'/Game/dice/D4_Dice_BP.D4_Dice_BP'"));
BP_d4 = (UClass*)BP_d4Object.Object->GeneratedClass;
Checking the DefaultEditor.ini, i saw this variable with a interesting name, set to true:
bDontLoadBlueprintOutsideEditor=true
I tried to set it to false:
bDontLoadBlueprintOutsideEditor=false
and bingo, my packaged game worked smooth and fine.
So this is no bug, but i think it would be nice to have it set to false by default when creating a new c++ project.
Thanks
Cedric
1 Like
hyperdr1ve
(hyperdr1ve)
November 13, 2014, 12:03am
2
What’s the reasoning behind having this defaulted to true? I came here because my packaged game was also crashing.
1 Like
MulleDK19
(MulleDK19)
November 13, 2014, 2:33am
3
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;
}
1 Like
uced
(uced)
November 13, 2014, 6:54am
4
Thanks MulleDK19, that’s gold to my newbie eyes !
This feature request can obviously be cancelled.
Or maybe replaced: could we then have an item “copy class reference” just below “copy reference” + the documentation alongside ?
The “copy reference” method is documented all around and that’s very misleading for beginners (or maybe i missed something ?).
BTW this also answers my other post on the correct way to use BP in code, which i mention here in case anyone reads this:
https://answers.unrealengine.com/questions/130256/whats-the-correct-way-to-load-blueprints-for-packa.html
Thanks
1 Like
darkgaze
(darkgaze)
September 4, 2018, 9:22am
6
Note the “_C” at the end. It’s not the name of the class, is a naming convention for the class of a blueprint. Don’t forget that!
1 Like
egdroid1
(egdroid1)
November 12, 2024, 6:50am
7
This solution is still required for UE 5.4.4. Works like a charm! Thanks so much!
1 Like