I have a big problem in Unreal, my blueprints keep breaking every time I add a component in C++ or change something in the script, this is really driving me crazy because the only solution I have found so far is deleting the blueprint and recreating it again from the C++ class.
I’ve placed a lot of enemies in the scene and I had to place them all over again because the REPLACE TOOL of UNREAL isn’t working so my question is:
How can I fix the Blueprint without recreating it or how you face this problem, MAYBE adding new components isn’t a good Idea, Maybe I have to do something in particular, any information will be helpful.
When you say the blueprint “breaks”, what exactly do you mean? I know that blueprints won’t compile properly if you rename variables and functions in C++ that are used in the blueprint.
If the blueprint doesn’t open (the Engine crashes when you try to open it), that usually means that you’ve moved/deleted huge chunks of code, and the blueprint can’t find the class it or its components derive from anymore.
Adding a simple component to the base C++ class shouldn’t break anything. The only scenario I can think of that would potentially break a blueprint is where the added component already exists in the blueprint with the same name (but even then I’m pretty sure the Engine just renames the BP component to ‘ComponentName_1’).
Thanks for your reply. What happens is that when I open the blueprint, that component I added or modified loses its properties in the Details Panels. When this happens, if I try to play the game the .AddDynamic of that component breaks (USphereComponent->OverlapFunc, I use .AddDynamic on the Start Method), making Unreal Engine crash completely, if I recreate the blueprint, that component begins to display information in the Details Panels and I am able to play the game normally.
I’m confused. Do you add an event in C++ or in Blueprint? Could you share some code/nodes on that?
Also, what property specifiers are you using for the component (the UPROPERTY macro)? It may be that you’re using the wrong specifiers.
Hi, I’ve found the problem. It seems that if you change the name on CreateDefaultSubobject(TEXT(“ThisName”)) after creating it, it causes that problem with that particular Component.
I’ve had the same issue with a custom movement component. Like you I had to rebuild my objects to get Unreal to not crash.
These are intended to be used for this, and do work fine for just moving classes around or renaming, but I couldn’t get them to work in the situation you outline:
I’m still getting this issue on 5.0.3, is there still no known workaround other than deleting and remaking blueprints inheriting from a broken class? It’s extremely time consuming and creates a lot of issues when this happens.
I’ve found that when trying to reference the broken component it is pointing to a REINST_ version of the component rather than whatever a correct one would be called. The outer of the REINST object is pointing to the engine/editor instead of the actual class instance which was causing crashes and other issues for me since attempting to GetWorld is nullptr.
I dug into it a little bit last night and found that initially in the object’s constructor it actually constructs the component correctly, but it goes through a step afterwards where it overwrites any changed properties (presumably from a child script) and it ends up overwriting the valid component with a REINST_ version that is setup incorrectly.
“We only do it if the DefaultData object is NOT a CDO of the object that’s being initialized”
so it seems there is a code path which initializes properties from somewhere other than the CDO, and, in my case at least, can override pointers to child components with zero