C++ changes "selectively" propagating to Blueprint

Hi, first post, getting into UE4.9, been through the programming tutorial (battery collector).

My issue is this: Having made a C++ actor class, and then created a blueprint class from it, it seems that changes in C++ code propagate to Blueprint in a very weird way. I have the following function:


void AAsteroid::SplitIntoPieces()
{
	//FRotator Direction1(0.f, 0.f, FMath::FRandRange(0.f, 360.f));
	FRotator Direction1(0.f, 0.f, 60.f);
	FRotator Direction2(0.f, 0.f, FMath::FRandRange(0.f, 360.f));

	UWorld* World = GetWorld();
	if (World && bSpawnChildren)
	{
		AAsteroid* Child1 = World->SpawnActor<AAsteroid>(GetClass(), GetActorLocation() + FVector(10, 0, 0), Direction1);
		AAsteroid* Child2 = World->SpawnActor<AAsteroid>(GetClass(), GetActorLocation() + FVector(-10, 0, 0), Direction2);
		//Child1->BodyMeshComponent->SetStaticMesh(BodyMeshComponent->StaticMesh);
		//Child2->BodyMeshComponent->SetStaticMesh(BodyMeshComponent->StaticMesh);
		UE_LOG(LogTemp, Warning, TEXT("Spawning children %s and %s"), *Child1->GetName(), *Child2->GetName());
		if (GEngine) GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Red, "Rotators: " + Direction2.Vector().ToString());
		Destroy();
	}
}

Earlier, the Direction2 variable was set to (0, 0, -90) and Direction1 to (0, 0, 90). After changing this and recompiling, they still behave like that, even though I’ve changed the values. And the weird part: I added the “if (GEngine)…” line just now, and that one did propagate! So I don’t know, common sense does not seem to work. The logging line proves that the new version of the function is used. However, the values of the direction variables seem “cached”? I don’t know how this works. I did restart the editor, still nothing, and replace the actor in the scene, and recompile the blueprint. Here is the UFUNCTION declaration for that function:


UFUNCTION(BlueprintCallable, Category = "Death", meta = (AllowPrivateAccess = "true"))
void SplitIntoPieces();

In case that changes anything. What do I need to do to make the code changes propagate?

The first thing you should check is that your Visual Studios log says something like “creating make files for hot reload” as one of the first lines when you compile.

If it does not say this, then it’s compiling the engine but not actually pushing it to the Unreal editor, and so you will not see any changes, even when restarting the editor.
To fix it, simply close Visual studios and open it through clicking a class within the editor (so it properly establishes a link to VS).

(This problem generally happens when you run VS on it’s own instead of opening it through the unreal editor)