diff --git a/Templates/Empty PhysX/game/scripts/client/serverConnection.cs b/Templates/Empty PhysX/game/scripts/client/serverConnection.cs index fa07fa830..8bac91813 100644 --- a/Templates/Empty PhysX/game/scripts/client/serverConnection.cs +++ b/Templates/Empty PhysX/game/scripts/client/serverConnection.cs @@ -121,6 +121,13 @@ function disconnectedCleanup() // Back to the launch screen if (isObject( MainMenuGui )) Canvas.setContent( MainMenuGui ); + + // Before we destroy the client physics world + // make sure all ServerConnection objects are deleted. + if(isObject(ServerConnection)) + { + ServerConnection.deleteAllObjects(); + } // We can now delete the client physics simulation. physicsDestroyWorld( "client" ); diff --git a/Templates/Empty/game/scripts/client/serverConnection.cs b/Templates/Empty/game/scripts/client/serverConnection.cs index fa07fa830..8bac91813 100644 --- a/Templates/Empty/game/scripts/client/serverConnection.cs +++ b/Templates/Empty/game/scripts/client/serverConnection.cs @@ -121,6 +121,13 @@ function disconnectedCleanup() // Back to the launch screen if (isObject( MainMenuGui )) Canvas.setContent( MainMenuGui ); + + // Before we destroy the client physics world + // make sure all ServerConnection objects are deleted. + if(isObject(ServerConnection)) + { + ServerConnection.deleteAllObjects(); + } // We can now delete the client physics simulation. physicsDestroyWorld( "client" ); diff --git a/Templates/Full PhysX/game/scripts/client/serverConnection.cs b/Templates/Full PhysX/game/scripts/client/serverConnection.cs index fdf4a9b8f..3857d24ce 100644 --- a/Templates/Full PhysX/game/scripts/client/serverConnection.cs +++ b/Templates/Full PhysX/game/scripts/client/serverConnection.cs @@ -222,6 +222,13 @@ function disconnectedCleanup() Canvas.setContent( MainMenuGui ); else if (isObject( UnifiedMainMenuGui )) Canvas.setContent( UnifiedMainMenuGui ); + + // Before we destroy the client physics world + // make sure all ServerConnection objects are deleted. + if(isObject(ServerConnection)) + { + ServerConnection.deleteAllObjects(); + } // We can now delete the client physics simulation. physicsDestroyWorld( "client" ); diff --git a/Templates/Full/game/scripts/client/serverConnection.cs b/Templates/Full/game/scripts/client/serverConnection.cs index fdf4a9b8f..3857d24ce 100644 --- a/Templates/Full/game/scripts/client/serverConnection.cs +++ b/Templates/Full/game/scripts/client/serverConnection.cs @@ -222,6 +222,13 @@ function disconnectedCleanup() Canvas.setContent( MainMenuGui ); else if (isObject( UnifiedMainMenuGui )) Canvas.setContent( UnifiedMainMenuGui ); + + // Before we destroy the client physics world + // make sure all ServerConnection objects are deleted. + if(isObject(ServerConnection)) + { + ServerConnection.deleteAllObjects(); + } // We can now delete the client physics simulation. physicsDestroyWorld( "client" );