Tank Blueprint Variable get reset to none!

Hey guys, I have an issue where my Projectile_BP in my Tank BP gets reset to none after every compile as well as after packaging. This makes it so that none of my actors can fire a projectile. Have I done something wrong here?
This happens to me in UE4.22 and UE4.23.

Project GitHub Link: https://github.com/raf1800/Open-Battle-Tanks/tree/master/BattleTank

Nope, it’s just a bug in the engine. Use the blueprint construction script.

I couldn’t get the construction script working so I googled around and found this : https://answers.unrealengine.com/questions/177409/assigning-tsubclassof-in-c.html

What I added in my TankAimingComponent.cpp:

#include "UObject/ConstructorHelpers.h"
UTankAimingComponent::UTankAimingComponent()
{
	PrimaryComponentTick.bCanEverTick = true;
	
	static ConstructorHelpers::FClassFinder<AProjectile> ProjectileBP(TEXT("Blueprint'/Game/Tank/Projectile_BP.Projectile_BP_C'"));
	ProjectileBlueprint = ProjectileBP.Class;
}

This sets the Projectile BP by default, overcoming the reset.

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