I use a very simple system for a player character: Mouse Click → Simple move to location.
Here is the problem:
I want to unpossess this character and spawn and possess a new one.
When I do this, simple move fails and I get this error:
“SimpleMove failed for “MyPlayerControllerClass”: movement not allowed”.
I did some testing and it turns out that if I don’t call simple move before swapping pawns it works on the other one. But if I call it then and swap back it fails on the first one.
Both classes are characters, have proper movement component, Navmesh is correctly setup and movement with normal inputs works fine.
So, as I understand, you give move task to character, and during task execution, you remove its controller, so task cannot be executed, because there is no controller anymore. What do you expect?
You need some different approach. Maybe AI character, with persistent AIController, which you can give move task by some communication with your player controller.
It’s the exact opposite. I don’t remove the controller. I unpossess the whole character and destroy it. I spawn a new character and possess that with the same player controller. And the same controller can’t issue “move to” to that new character.
When I destroy the character I don’t care about its task anymore. It’s obvious that it won’t be completed. But the same player controller now has a NEW character that it possesses. And commands issues to the new character fail.
It’s nothing weird. Simple example would be this:
Top down game (mouse click to move), player steps on a platform, current character is destroyed and a new player character of a specific class is spawned and possessed. Like character selection.
Player character has an event: Left mouse button → get hit result under cursor → simple move to.
It shoudn’t matter what the character it possesses and what it possessed before. I check controlled pawn before calling simple move to and it returns the new character. Everything works, except for that move to.
This needs to be debugged. According to code of SimpleMoveTo function, new character have some problems with movement or path following components.
Or you can try to use AI character. Spawn AI from class, reference it, get its controller, make it to move to. this is very simple, and this is not so dangerous as destroying one character and possessing another by the same player controller.
There are plenty of workaround that I can use, but there are benefits from it being a player character. It’s all just for a demo scene so I want it to be as simple and as clear as possible.
I though possessing a new pawn would be
same problem
i destroy one pawn, spawn another one, possess, and got this error, if first one moves before destroying
same problem, as “Allow Client Side Navigation” is False, but its True
any ideas, someone?