Hello! So I have projectiles in my game, I wish multiple entities to be able to use the same projectiles, but that the projectile inherits some values from the entity in order to modify it slightly.
E.G. the shot moves at different speeds depending on who fires it.
ProjectileMovement->InitialSpeed = Cast<AWinstickPawn>(Owner)->ShotSpeed; ProjectileMovement->MaxSpeed = Cast<AWinstickPawn>(Owner)->ShotSpeed;
I am presuming the crash happens because InitialSpeed and MaxSpeed are predetermined to be editable ints or floats in the editor and when it suddenly points to a value in an actor that doesn’t exist yet, it doesn’t know what to do and crashes.
What’s the best way to set the speed other than in the constructor? If I set these values after the fact, the projectile has already launched at the default speed.
Currently the “easy” solution would be to make a seperate projectile for each entity and just preset the speeds. But that would mean tons of duplicate projectiles that are otherwise identical apart from those values.