Download

How to remove an Actor?

Hello,

Strange things happens… I have some test project with an actor defined in C++ and blueprint based on this actor. At some point I call destroy inside my actor and everything fine.

Next, I migrate this actor to a game project and suddenly after calling to Destroy() it continue to tick. Calling MarkPendingKill() together with Destroy() stops ticking, and actor disappears from screen but it still participates in pathfinding.

So, a question: why my actor not destroyed properly and how to remove it completely?

P.S.: I place my actor with my hands in editor, never call it in my code, so I keep no reference to it.

I’ll answer to my questions in case someone will stuck with the same problem.

  1. When I ran test project - it ran as listen-server. When I ran a game - it used dedicated server. And actor can be destroyed on server only. I needed to call remote function.
  2. In controller I’m calling GetWorld()->DestroyActor() (server function). It works. The same stuff but in Actor - not works. So, I make an assumption that it depends - where from call the RPC, but it would be cool to know exactly why It works that way.