@@ -1066,7 +1066,7 @@ internal void HandleApproval(ulong clientId, ulong? prefabHash, bool approved, V
10661066
10671067 // This packet is unreliable, but if it gets through it should provide a much better sync than the potentially huge approval message.
10681068 SyncTime ( ) ;
1069-
1069+
10701070 NetworkedObject netObject = SpawnManager . CreateLocalNetworkedObject ( false , 0 , ( prefabHash == null ? NetworkConfig . PlayerPrefabHash : prefabHash . Value ) , null , position , rotation ) ;
10711071 SpawnManager . SpawnNetworkedObjectLocally ( netObject , SpawnManager . GetNetworkObjectId ( ) , false , true , clientId , null , false , 0 , false , false ) ;
10721072
@@ -1171,7 +1171,7 @@ internal void HandleApproval(ulong clientId, ulong? prefabHash, bool approved, V
11711171
11721172 //Inform old clients of the new player
11731173
1174- foreach ( var clientPair in ConnectedClients )
1174+ foreach ( KeyValuePair < ulong , NetworkedClient > clientPair in ConnectedClients )
11751175 {
11761176 if ( clientPair . Key == clientId || ! ConnectedClients [ clientId ] . PlayerObject . observers . Contains ( clientPair . Key ) )
11771177 continue ; //The new client.
@@ -1198,15 +1198,21 @@ internal void HandleApproval(ulong clientId, ulong? prefabHash, bool approved, V
11981198 writer . WriteUInt64Packed ( prefabHash == null ? NetworkConfig . PlayerPrefabHash : prefabHash . Value ) ;
11991199 }
12001200
1201- writer . WriteBool ( false ) ; //Object won't have DestroyWithScene enabled.
1202-
1203- writer . WriteSinglePacked ( ConnectedClients [ clientId ] . PlayerObject . transform . position . x ) ;
1204- writer . WriteSinglePacked ( ConnectedClients [ clientId ] . PlayerObject . transform . position . y ) ;
1205- writer . WriteSinglePacked ( ConnectedClients [ clientId ] . PlayerObject . transform . position . z ) ;
1201+ if ( ConnectedClients [ clientId ] . PlayerObject . IncludeTransformWhenSpawning == null || ConnectedClients [ clientId ] . PlayerObject . IncludeTransformWhenSpawning ( clientId ) )
1202+ {
1203+ writer . WriteBool ( true ) ;
1204+ writer . WriteSinglePacked ( ConnectedClients [ clientId ] . PlayerObject . transform . position . x ) ;
1205+ writer . WriteSinglePacked ( ConnectedClients [ clientId ] . PlayerObject . transform . position . y ) ;
1206+ writer . WriteSinglePacked ( ConnectedClients [ clientId ] . PlayerObject . transform . position . z ) ;
12061207
1207- writer . WriteSinglePacked ( ConnectedClients [ clientId ] . PlayerObject . transform . rotation . eulerAngles . x ) ;
1208- writer . WriteSinglePacked ( ConnectedClients [ clientId ] . PlayerObject . transform . rotation . eulerAngles . y ) ;
1209- writer . WriteSinglePacked ( ConnectedClients [ clientId ] . PlayerObject . transform . rotation . eulerAngles . z ) ;
1208+ writer . WriteSinglePacked ( ConnectedClients [ clientId ] . PlayerObject . transform . rotation . eulerAngles . x ) ;
1209+ writer . WriteSinglePacked ( ConnectedClients [ clientId ] . PlayerObject . transform . rotation . eulerAngles . y ) ;
1210+ writer . WriteSinglePacked ( ConnectedClients [ clientId ] . PlayerObject . transform . rotation . eulerAngles . z ) ;
1211+ }
1212+ else
1213+ {
1214+ writer . WriteBool ( false ) ;
1215+ }
12101216
12111217 writer . WriteBool ( false ) ; //No payload data
12121218
0 commit comments