Change Characters

In the Sandbox scene there is a space for changing characters on the fly. You can check out the code in the CharacterSwapTrigger class to see how this easily works.
Here's an example of how you might do this yourself:
[AssetDropdown(typeof(ProdigyAgentDefinition))]
public ProdigyAgentDefinition DesiredAvatar;
​
public void ChangeAvatar(ProdigyPlayer player)
{
player.TrySetAvatarDefinition(DesiredAvatar);
player.RequestRespawn(agent.transform.position);
}
In the above example, it sends a request the change the ProdigyAgentDefinition that this ProdigyPlayer should be using. This just changes the preferred value, but in order to actually force the avatar to change in the world we must also respawn the ProdigyPlayer's Avatar which is done in the next line.