First Person Projectile Lifespan

In the first person blueprint, the projectile is spawned when you click the left mouse button. Shortly after, it disappears which is good for testing. I want to know how to expand the lifetime of the projectile or how to make it so it remains forever. Thanks

Every Actor has a Lifespan that can be adjusted in the Details panel for the root component. I believe for the projectile, it may or may not also be coded into the Event Graph to delete itself after a certain amount of time. You may want to check there as well.

2 Likes

Found exactly what i was looking for, thank you so much

You are welcome.

Could you please tell, in which C++ files to look (in FirstPerson c++ template).

ProjectNameProjectile.app has a variable “InitialLifeSpan = 3.0f”,
but changing it does not increase time for projectiles (even if you shoot in the air (no collision with physics), so there must be something else.
Does code project contain event graph, or that animation is completely in cpp code?

update:
solved by deleting all binaries in "ProjectName\Binaries\Win64" (which requires closing UE first), gonna try 4.11 p4 instead of 4.10
or
by commenting/uncommenting with building and testing (in-between commenting/uncommenting) the “Destroy();” in Projectile::OnHit method (same cpp file)

update2:
its not related to neither to DLL binaries, nor commenting “Destroy();”.

After more testing, looks, like the only problem that happens for sure - for some reason changing “InitialLifeSpan = 3.0f” has no effect until you reopen the Project in Unreal Editor, any other changes to cpp code (like commenting/uncommenting “Destroy();”) do work as intended, only changing “InitialLifeSpan” does not, until you reopen your project in Unreal Editor, today i tried it on new FirstPersonTemplate Project, so its easy to reproduce.

Reported the bug already.

For others seeking the answer to the projectile lifespan, here it is:
In the FirstPersonProjectile Blueprint, select the FirstPersonProjectile(self) component & its located under details, Actor, Initial Life Span.

Wow, talk about a blast from the past. :slight_smile:

I’m actually having an issue with my projectile’s life span, but the life span is set to 0 so that it’d survive until destroy actor is called. I tried extending to 10 seconds it as well, but it still destroys itself in 3 seconds. Is there some other place I should look?

I’m actually having an issue with my projectile’s life span, but the life span is set to 0 so that it’d survive until destroy actor is called. I tried extending to 10 seconds it as well, but it still destroys itself in 3 seconds. Is there some other place I should look?
[/QUOTE]

Having the same problem today, found a way ?

There’s definitely a bug in the engine (I’m using 4.27.1) If you set InitialLifeSpan in C++ the editor value is ignored so changing it does nothing. You also need to restart your editor for the c++ value to change.