What is the new ? Why is the new form better than previous ?
Where is the difference?
Old form:
New form:
What is the new ? Why is the new form better than previous ?
Where is the difference?
Old form:
New form:
I’m not sure why that is done, it’s essentially just moving where the cast is done.
The first casts the pawn to ATank (in C++) to get the aiming component.
The second searches the components for the first ATankAimingComponent
which would most likely be done via iterating over the components and casting each to ATankAimingComponent
until the cast doesn’t result in nullptr
What do you mean? I’m saying it shouldn’t make a difference.
The first solution could not change the color of the crosshair till after modifying the c++ code.
So we were forced to update the blueprint solution as the second picture shown above.
Looking at the code for this lecture, it doesn’t look like TankAimingComponent
is ever assigned a value.
Adding this before Super::BeginPlay
should make it work.
void ATank::BeginPlay()
{
TankAimingComponent = FindComponentByClass<UTankAimingComponent>();