Description
When using connection approval and setting the players position and rotation, it doesn't work correctly. It always spawns at 0,0,0 with rotation 0,0,0.
I upgraded from 1.7.1 to 2.0.0, and everything seems to be working fine (not a complex project) except for the spawning of players. Obviously they should spawn at the position and rotation that I set.
Example:
Transform spawner = GameObject.FindGameObjectWithTag("Spawner").transform;
response.Approved = true;
response.CreatePlayerObject = true;
response.Position = spawner.position;
response.Rotation = spawner.rotation;
When adding Debug.Log to check the position and rotation, it prints the expected values (in my case, somewhere around 30, 60, 50 for position). This means the Transform spawner was found, and all of this is working. But when the player spawns, it's always at 0,0,0.
I tried different player prefabs and different settings, but nothing worked. I also just created a new project with the Bootstrap sample and just added this code to the BootstrapManager:
private void ApprovalCheck(NetworkManager.ConnectionApprovalRequest request, NetworkManager.ConnectionApprovalResponse response)
{
response.Approved = true;
response.CreatePlayerObject = true;
response.Position = Vector3.one;
Debug.Log(response.Position); //prints 1,1,1
response.Rotation = Quaternion.identity;
}
and networkManager.ConnectionApprovalCallback += ApprovalCheck;
before it starts the host on line 21. Then I also enabled connection approval on the network manager in the scene. I would expect the player to spawn at 1,1,1 but it spawns at 0,0,0.
I use Netcode 2.0.0 and Unity 6000.0.20f1 on Windows