Projectile Component's InitialSpeed resets to 3000

I have this code in the constructor of my bullet class

	ProjectileComponent = CreateDefaultSubobject<UProjectileMovementComponent>(TEXT("Projectile Component"));
	ProjectileComponent->InitialSpeed = 100000;
    ProjectileComponent->Velocity = FVector(1, 0, 0);

to set up a Projectile Component.
It is not editable when inherited so you can’t change initial speed value in the editor.
When I fire my weapon, the bullet won’t fire at the speed I specified in the code. It will fire at the speed of 3000 (I could check that by printing the value of InitialSpeed when the game starts).

Anyone knows what might be the problem? Thanks in advance!

This might sound like a patronizing question but are you sure you’re not setting the MaxSpeed of the projectile movement component to 3000.0f?

Yes, I’m sure. I tested it by setting the max speed in the code to the same as the initial speed. No luck with that.

Ok so it looks like this is a bug… If I add UPROPERTY(VisibleDefaultsOnly) to ProjectileComponent so I can edit the initial speed in the editor and reset it to the default value (by clicking the yellow arrow), it works. When I remove UPROPERTY(VisibleDefaultsOnly) and change the value of the initial speed via code I will still get the value that was in the editor (even though you can’t edit it from the editor and the value was set to stay as default).
If you make the value as default and change it via code while it is exposed to the editor, changes will be propagated to the BP (BP value will be the same as the code). But if you make it invisible to the editor and change the value in the code the old value will persist.

Maybe UE4 is serializing the value that was in the editor and keeping that serialized value from the input box instead of keeping it defaulted to the code. A better question is whether UE4 should even keep the serialized value if it is not available in the editor…

EDIT: Just ALWAYS make all components UPROPERTY(). Done. Solved. Lesson learned (the painful way).