I am trying to get my characters to change between forms on button press via blueprints. Currently testing with four characters from the free mixamo animation pack. So far I have been able to get it to semi work, I can change forms once but not back to the destroyed mesh. In each form are the button commands like below where on button press- cast to the current character- and get player pawn. Then I spawn the appropriate actor at the location of an arrow component named SpawnLocation attached to the old character. I possess the new actor and destroy the old. I get the new character in the location I want but I a unable to change back to the previous form? I have tried this numerous ways and found if I destroy the old actor/pawn first I lose the coordinates for the new form and the new character defaults to the start spawn location in the level or 0,0,0 which generates an error. I even tried destroying components which worked great in editor but crashed on button press during runtime
Hello Korubi,
**Method 1 - **
If you destroy an actor every data in it will be lost. What I would do for your setup is save the data you want to save by putting those in variables, which you can then send to the newly spawned actor by casting to him/her. (this is done via casting, drag off of the return value of your SpawnActor Maw and type in Cast to and you will find the correct node.)
This way once you possess the new actor, you will still have access to the variables because they got sent to the new actor you’re now controlling. Make sure you only destroy the actor after you cast to the new actor and possess it though or it won’t work.
**Method 2 - **
You could also simply spawn a new actor and the possess, but instead of destroying the previous actor just set its visibility to hidden and remove his/her collision.