Corrupted BP after add/del components in C++

Hello,

Adding/suppressing components in C++ seems to corrupt the blueprint inheriting from the C++ class.

To obtain the herebelow screenshot, i did the following.

  • create a class inheriting from AActor

  • add some components in it (among them, a UStaticMeshComponent)

  • create some blueprints from this class (editor, runtime, run game a few times)

  • then add a UTextRenderComponent

  • use the blueprints

  • then supress the UTextRenderComponent

  • i’m in the following state:

    UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Yag)
    UStaticMeshComponent* SeeMeSphere;

    //UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Yag)
    // UTextRenderComponent* TextComponent;

The problem is that adding/deleting the UTextRenderComponent seem to have corrupted the UStaticMeshComponent.

I have a lot of other components that behave well, so it might be important that the UTextRenderComponent is placed right after the UStaticMeshComponent.

Anyway, in the following screenshot:

The BP on top is an old BP (created before messing with the UTextRenderComponent), you can see that the UStaticMeshComponent detail panel is empty.

The BP on bottom is a freshly created BP (after messing with the UTRC) and you can see it’s correct (detail panel OK).

In addition, whenever i place an old BP in game, as soon as i try to access the UStaticMeshComponent, i get a crash.

So the UStaticMeshComponent (which, to be clear, i never touched in code) seems to exist and not exist at the same time: it shows in the editor with the correct mesh in the preview panel, but an empty detail panel, and is not accessible in game.

I tried to delete the Saved directory hoping to clean some cache, tried to move the BP back and forth in some other dir (a workaround that worked very well in a somewhat similar issue), but no luck so far.

I sure could recreate all my old BP but that wouldn’t really solve the problem, and moreover i have 150+ of them and this means 2 days of stupid repetitive work, so if i could just fix them one way or another, i would be very happy :slight_smile:

Thanks

Cedric

oups, sorry, correction: i inherit from APawn and not AActor.

Hey -

When following the steps provided, I still see the full details of my static mesh component. Can you provide the source code (the .cpp file) for your setup? Additionally, please provide the callstack and log files from the crash for additional information. If you’re able to reproduce this behavior in a new project, it may also be helpful to provide the sample project for investigation. Additionally, did this occur after a hot reload? If so, does the same thing occur if you compile the code changes with the editor closed?

Hey ,

Thanks for having a look !

Here is the cpp file for the pawn and the logs right after a crash.

To obtain the crash, i uncommented all calls to the static mesh (SeeMeSphere) and put a blueprint derived from this pawn on my map: this make the game crash on launch because there is a call to the SeeMeSphere in the tick function (line 420 as indicated in the logs/callstack).

I forced the crash in PIE but didn’t find anything interesting in the logs, so i also made a crash in a standalone game, which comes with a minidump and an access violation in the logs.

Also i don’t know where to find the callstack, so i just took a screenshot of it, if it’s not enough, please tell me where to find it.

![alt text][1]

I enclose everything here, please let me know if you need anything else.

I’ll see if i manage to reproduce this on a fresh project, i’ll let you know of course.

Cheers

Cedric

Using the code provided I was still unable to create an instance where the component was unavailable or cause a crash to occur. Looking at line 420, if you run the project in VS debug mode can you confirm if SeeMeSphere is null or if ThisPC is null? If possible, please provide a copy of the project with this occurring to help me test the crash locally.

Hi !

I am absolutely positive that ThisPC is defined, if you look a little bit above you’ll see that it’s casted from a ThisController variable and i always put a check after each casting:

// PC
AYagPlayerController* ThisPC = Cast<AYagPlayerController>(ThisController); 
if (!ThisPC) return;

But to be sure i ran the game in debug mode when crashing and here’s the result:

I unfortunately can’t easily send you the project (insanely huge amount of content and a lots of interactions between code and content, so it would require a lot of work to make a portable and working version of it) but if you want anything like a log/dump/video or a bit of code, please let me know.

Thanks

Cedric

Hey Cedric,

Sorry for the late reply, so far in my test no combination of adding/removing/comment/uncommenting a TextRenderComponent declaration has led to the details panel of another component being empty. Can you let me know if adding the text render component back in causes the details panel to fill again? Additionally, what happens if you create a new Actor class with StaticMeshComponent / TextRenderComponent then comment/uncomment the TextRenderComponent? Does a blueprint of the new class show the same behavior? Is your TextRenderComponent defined in the class constructor with a CreateDefaultSubobject line? Is this commented out as well when you comment the declaration?

Hey Cedric-

We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will follow up. If possible, please also include a small sample project demonstrating the issue.

Cheers