I have a struct in my project that is preventing the project from opening.
From what i’ve read this is a fairly common problem - is there a way i can go about fixing this externally so that the project will open?
Thanks
I have a struct in my project that is preventing the project from opening.
From what i’ve read this is a fairly common problem - is there a way i can go about fixing this externally so that the project will open?
Thanks
Is it a blueprint struct or a C++ struct?
In the first case you could just rename the .uasset file and the project should open (with errors where there are struct references but it should), if it’s a C++ struct you probably need to recompile the project from the IDE
Hi thanks for replying -
It’s a blueprint struct -
I tried renaming the extension and then just making a new one - but that struct got corrupted to - is there a way around this?
Thanks!
Have you tried getting rid of the asset file, rather than putting an empty one there?
I have indeed - no luck, it just corrupts whenever i make a new struct, very frustrating!
Is there a way of making a struct (BP) without it corrupting? as this seems to be a fairly common problem?
Are you giving the new struct a different name?
yeah i am - just apending V2, V3 etc - is that okay? i can’t imagine that’d cause issues, would it?
If anything, that would help.
Structs are a bit flaky in BP. I gave up using them in the end. Especially recursive ones.
Is it a very ‘adventurous’ struct?
hmmm odd!
How do you get around not using BP structs? do you just code them in c++? (im not a c++ user unfortunately!)
I dont have many frames of reference, but id say it’s not very adventurous at all, its just one struct with a few variables, almost all floats or text, with one image (it’s just for an inventory system) - is it possible to do this without the use of structs?
Structs are a right pain in the bum to use. Almost every case where you would use structs, you can avoid them. What’s your use case?
as i’m learning i just want to store all the variables for interactable items (just the classic RPG stuff, health etc) - is it possible to do this all with just a parent item BP and have children inherit all the variables from it? or will that be too expensive?
Can you describe what you have at the moment?
What’s in the struct?
So in the struct i have one text variable (item name) a few floats/integers (price/sellvalue/potentcy/damage etc) a reference to the object class and an image for the thumbnail of that object - that’s pretty much it!
Try adding an empty C++ class to your project and paste this inside the .h file:
USTRUCT(BlueprintType)
struct YOUR_API FInteractableItem
{
GENERATED_USTRUCT_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FText ItemName;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
int32 BuyPrice;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
int32 SellPrice;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
int32 Potency;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
UTexture2D *Thumbnail = nullptr;
};
Replace YOUR with the name of your project (capitalized) and compile, you should be able to see the struct in the editor
Right… right…
This is going to sound nuts, but change the object reference to one of int, enum or string.
Somewhere else, in code, you can convert that into the object ( at runtime ).
I’ll tell you why… ( we sit down by the fire for a long story )
Before I released my game, I had a crash that wouldn’t go away. It took me about 3 months to find it. Things tried included debugging the engine source. I eventually tracked it down to exactly this kind of thing. Basically, if you look at your stuff in the reference viewer, you’ll have a ‘black hole’ disappearing up it’s own ****. Primarily because objects end up referring to themselves.
Long story short, change it to a logical ref ( as above ), and all your problems go away…
I also recommend this to help you find this kind of thing