Download

Solved:Pawn is attached to Landscape which is in another level. Using actor's location as collision

I found an error that I had never come across before. I’m posting my solution in case anyone else comes across it.

I have some NPC pawns that have a pretty simple controller. The controller waits a random amount of time, picks a random direction, and then moves the pawn in that direction for a random amount of time, and repeats. I place these pawns in a level in the editor. When the level loads, the pawns start wandering around. When I unload the level, I get these messages in my log over and over on every tick:


[0185.33] Log: RPGTacPawn_Chicken_0 is attached to Landscape_3 which is in another level.  Using actor's location as collision center.
[0185.33] Log: RPGTacPawn_Chicken_1 is attached to Landscape_3 which is in another level.  Using actor's location as collision center.
[0185.33] Log: RPGTacPawn_Chicken_2 is attached to Landscape_3 which is in another level.  Using actor's location as collision center.
[0185.34] Log: RPGTacPawn_Chicken_3 is attached to Landscape_3 which is in another level.  Using actor's location as collision center.
[0185.34] Log: RPGTacPawn_Chicken_4 is attached to Landscape_3 which is in another level.  Using actor's location as collision center.
[0185.34] Log: RPGTacPawn_Chicken_5 is attached to Landscape_3 which is in another level.  Using actor's location as collision center.
[0185.34] Log: RPGTacPawn_Chicken_5 is attached to Landscape_3 which is in another level.  Using actor's location as collision center.

These are the only pawns that cause this problem. All of the other pawns in the level disappear quietly when their level gets unloaded.

SOLUTION:

In native code, there’s a comment above this message indicating that this happens when a collision component has been detached but not removed from the game. To solve this problem, I placed a Force Garbage Collection Kismet node immediately after the node that I use to unload the level. That solved it. I don’t know why these are the only pawns that caused this problem, but because the error is gone, I’m not going to dig any deeper.

I had a similar problem when a stream level with pawns is unloaded, the pawns were destroyed, but their controllers were created in the persistent level and continue working. So I had to add a control to destroy them when pawn = none.