@@ -228,7 +228,7 @@ internal static void HandleConnectionApproved(uint clientId, Stream stream, int
228228 bool isPlayerObject = reader . ReadBool ( ) ;
229229 uint networkId = reader . ReadUInt32Packed ( ) ;
230230 uint ownerId = reader . ReadUInt32Packed ( ) ;
231- int prefabId = reader . ReadInt32Packed ( ) ;
231+ ulong prefabHash = reader . ReadUInt64Packed ( ) ;
232232 bool isActive = reader . ReadBool ( ) ;
233233 bool sceneObject = reader . ReadBool ( ) ;
234234
@@ -240,7 +240,7 @@ internal static void HandleConnectionApproved(uint clientId, Stream stream, int
240240 float yRot = reader . ReadSinglePacked ( ) ;
241241 float zRot = reader . ReadSinglePacked ( ) ;
242242
243- NetworkedObject netObject = SpawnManager . CreateSpawnedObject ( prefabId , networkId , ownerId , isPlayerObject ,
243+ NetworkedObject netObject = SpawnManager . CreateSpawnedObject ( SpawnManager . GetNetworkedPrefabIndexOfHash ( prefabHash ) , networkId , ownerId , isPlayerObject ,
244244 new Vector3 ( xPos , yPos , zPos ) , Quaternion . Euler ( xRot , yRot , zRot ) , stream , false , true ) ;
245245 netObject . sceneObject = sceneObject ;
246246 netObject . gameObject . SetActive ( isActive ) ;
@@ -267,7 +267,7 @@ internal static void HandleAddObject(uint clientId, Stream stream, int channelId
267267 bool isPlayerObject = reader . ReadBool ( ) ;
268268 uint networkId = reader . ReadUInt32Packed ( ) ;
269269 uint ownerId = reader . ReadUInt32Packed ( ) ;
270- int prefabId = reader . ReadInt32Packed ( ) ;
270+ ulong prefabHash = reader . ReadUInt64Packed ( ) ;
271271 bool sceneObject = reader . ReadBool ( ) ;
272272
273273 float xPos = reader . ReadSinglePacked ( ) ;
@@ -285,7 +285,8 @@ internal static void HandleAddObject(uint clientId, Stream stream, int channelId
285285 netManager . ConnectedClients . Add ( ownerId , new NetworkedClient ( ) { ClientId = ownerId } ) ;
286286 netManager . ConnectedClientsList . Add ( netManager . ConnectedClients [ ownerId ] ) ;
287287 }
288- NetworkedObject netObject = SpawnManager . CreateSpawnedObject ( prefabId , networkId , ownerId , isPlayerObject ,
288+
289+ NetworkedObject netObject = SpawnManager . CreateSpawnedObject ( SpawnManager . GetNetworkedPrefabIndexOfHash ( prefabHash ) , networkId , ownerId , isPlayerObject ,
289290 new Vector3 ( xPos , yPos , zPos ) , Quaternion . Euler ( xRot , yRot , zRot ) , stream , hasPayload , true ) ;
290291
291292 netObject . sceneObject = sceneObject ;
@@ -386,7 +387,7 @@ internal static void HandleAddObjects(uint clientId, Stream stream, int channelI
386387 bool isPlayerObject = reader . ReadBool ( ) ;
387388 uint networkId = reader . ReadUInt32Packed ( ) ;
388389 uint ownerId = reader . ReadUInt32Packed ( ) ;
389- int prefabId = reader . ReadInt32Packed ( ) ;
390+ ulong prefabHash = reader . ReadUInt64Packed ( ) ;
390391 bool sceneObject = reader . ReadBool ( ) ;
391392
392393 float xPos = reader . ReadSinglePacked ( ) ;
@@ -402,7 +403,7 @@ internal static void HandleAddObjects(uint clientId, Stream stream, int channelI
402403 netManager . ConnectedClients . Add ( ownerId , new NetworkedClient ( ) { ClientId = ownerId } ) ;
403404 netManager . ConnectedClientsList . Add ( netManager . ConnectedClients [ ownerId ] ) ;
404405 }
405- NetworkedObject netObject = SpawnManager . CreateSpawnedObject ( prefabId , networkId , ownerId , isPlayerObject ,
406+ NetworkedObject netObject = SpawnManager . CreateSpawnedObject ( SpawnManager . GetNetworkedPrefabIndexOfHash ( prefabHash ) , networkId , ownerId , isPlayerObject ,
406407 new Vector3 ( xPos , yPos , zPos ) , Quaternion . Euler ( xRot , yRot , zRot ) , stream , false , true ) ;
407408 netObject . sceneObject = sceneObject ;
408409 }
0 commit comments