Ue crashes every time i run game with GetActorLocation

When I compile below code in unreal it is successful. But when I run it crashes my unreal engine.
I narrowed it down to GetActorLocation line:

// Called every frame
void AMovingActor::Tick(float DeltaTime)

	//UE_LOG(LogTemp, Warning, TEXT("Hello World!"));

	FVector cur_actor_loc = GetActorLocation();

	//if (cur_actor_loc.Z < 50 || cur_actor_loc.Z > 500) {
	//	platform_movement_offset = platform_movement_offset * -1;
	//cur_actor_loc.Z = cur_actor_loc.Z + platform_movement_offset;

What does this error even mean??


Fatal error: [File:D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\Templates\Casts.cpp] [Line: 10] Cast of Object /Script/CoreUObject.Default__Object to Actor failed

just to add SetActorLocation(FVector(1,2,3)) works fine, something with GetActorLocation only

Ok I have no idea what’s going on but today I reopened project to try again, it tells me modules are missing for my project and to try and rebuild them.

After rebuilding it works fine.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms