HELP ! UE4.25.3 Error! Blueprint components missing location and rotations

Hello,

I recently moved from unity to UE4 due to better graphics enviroment. I managed to get substepping working after long period of time and now i have large struggle with blueprints x C++.

I have made components that should represent a vehicle in c++. It is going to be a large game, i spent like a year just modeling the cars.

Here is what is my issue:

I created base pawn that uses substepping. In c++, this pawn always creates default root object (StaticMeshComponent).
Then I create new blueprint that inherits this c++ class. It represents a vehicle.
It is all automated process, so i can work with fbx scenes i import later (i can set parent class as the car from the c++ class).

This is the part where it comes to other things (solid axle, wheel etc). In this blueprint, i add solid axle. (Solid axle (derived from scene component)) and for each axle i use 2 wheels as children, one with tag rightWheel and second one with tag leftWheel. On beginPlay everything gets assigned correctly.

Everything seems to work alright, suspension works, however! There is some strange issue. When i change something inside these c++ classes thru VS (may it be just name of variable/new value), then recompile in editor, this changed component loses its location and rotation attribute in its transform. I JUST CANT SEE IT!! All these components are either located at 0,0,0 or just flickering randomly between points they were initially placed. Also every component of same type shares its values between all other components, so if i set springStiffness to 100 on right wheel, it will be same on every other wheel… I have no ■■■■■■■ clue what to do. I cannot make stable framework for creating vehicles in blueprints if the engine keeps resetting transforms of components i’ve placed.

Im completely lost so that is the reason why i decided to ask here, im absolutely hopeless.
I will provide code for all the classes if that can help. I was searching all over the net and no solution seems to be working properly…

If you are adding components from C++, you have to call SetupAttachment for them, otherwise things will get weird.



// Pseudo code...

WeaponMeshComp = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("WeaponMeshComp"));
RootComponent = MeshComp;

WeaponSightComp = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("WeaponSightComp"));
WeaponSightComp->SetRelativeLocation(FVector(0.0f, 5.0f, 10.0f));
WeaponSightComp->SetupAttachment(RootComponent);


Yeah, see the thing is that i do not make attachments in c++, because the locations of components vary from car to car. i just make the root static mesh in c++, rest is just a blueprint derived from c++, where i add other c++ components(from BP side). I did set the static mesh as root component. Also i just found out that if i shut down ue4, then compile changes in vs and re-run ue4, this issue goes away. Seems like a bug to me, but who knows…

1 Like

I spent hours trying to fix this same issue…I restarted my editor and everything fixed itself lol

3 Likes

This is still the solution in 5.4

1 Like