@@ -1066,7 +1066,7 @@ internal void HandleApproval(ulong clientId, ulong? prefabHash, bool approved, V
1066
1066
1067
1067
// This packet is unreliable, but if it gets through it should provide a much better sync than the potentially huge approval message.
1068
1068
SyncTime ( ) ;
1069
-
1069
+
1070
1070
NetworkedObject netObject = SpawnManager . CreateLocalNetworkedObject ( false , 0 , ( prefabHash == null ? NetworkConfig . PlayerPrefabHash : prefabHash . Value ) , null , position , rotation ) ;
1071
1071
SpawnManager . SpawnNetworkedObjectLocally ( netObject , SpawnManager . GetNetworkObjectId ( ) , false , true , clientId , null , false , 0 , false , false ) ;
1072
1072
@@ -1171,7 +1171,7 @@ internal void HandleApproval(ulong clientId, ulong? prefabHash, bool approved, V
1171
1171
1172
1172
//Inform old clients of the new player
1173
1173
1174
- foreach ( var clientPair in ConnectedClients )
1174
+ foreach ( KeyValuePair < ulong , NetworkedClient > clientPair in ConnectedClients )
1175
1175
{
1176
1176
if ( clientPair . Key == clientId || ! ConnectedClients [ clientId ] . PlayerObject . observers . Contains ( clientPair . Key ) )
1177
1177
continue ; //The new client.
@@ -1198,15 +1198,21 @@ internal void HandleApproval(ulong clientId, ulong? prefabHash, bool approved, V
1198
1198
writer . WriteUInt64Packed ( prefabHash == null ? NetworkConfig . PlayerPrefabHash : prefabHash . Value ) ;
1199
1199
}
1200
1200
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 ) ;
1206
1207
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
+ }
1210
1216
1211
1217
writer . WriteBool ( false ) ; //No payload data
1212
1218
0 commit comments