How to check how long an actor has been spawned


I’m trying to create to type of actors that overwrite each other (dots on the ground at the moment). But I want them to destroy the other only if the other is older ( so that both don’t get destroyed every time they overlap)

Thank you !

I think the simplest way to do this is just to add a FDateTime variable (call it “Lifetime” or some such) to your actor. When your actor is constructed you can just set that variable to FDateTime::Now(), then just compare the two actors lifetimes when a collision happens and run whatever logic you want.

Thank you, that would certainly work. One thing I can’t seem to succeed to do is compare the actor variable to one of the actor not yet created. I can’t cast it from the overlap node, since it’s a generic node. Not sure if I’m clear here, all in all I’m just not sure how to compare the two on the overlap occurred.

Get Game Time Since Creation