UProjectileMovementComponent with bAutoActivate set to false doesn't need to call Activate() to start moving


I’m trying to understand how UProjectileMovementComponent works. In the class constructor I have:

 	// Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = false;

	CollisionComp =
		CreateDefaultSubobject<UBoxComponent>(TEXT("Box Collider"));

	BallMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Ball Mesh"));
	RootComponent = CollisionComp;

	ProjectileMovementComponent =
		CreateDefaultSubobject<UProjectileMovementComponent>(TEXT("Ball Movement Component"));
	ProjectileMovementComponent->MaxSpeed = 1300.f;
	ProjectileMovementComponent->InitialSpeed = 1300.f;
	ProjectileMovementComponent->ProjectileGravityScale = .0f;
	ProjectileMovementComponent->bAutoActivate = false;


And in another method:

void ABall::Fire()
	ProjectileMovementComponent->SetVelocityInLocalSpace(FVector(-1.f, 1.f, 0.f) * 1300.f);

And the ball moves without calling Activate().

Don’t I need to call it to move the projectile (the ball)?


Even if I rebuild the code in Visual Studio or/and even using live coding from Unreal editor, the code doesn’t update on Unreal.

This is why it moves without using Activate(), because it is using an old version of the code in Unreal Editor.

Make sure VS is configured to compile for Development-Editor configuration

1 Like