private void OnBecameInvisible() { rb.bodyType = RigidbodyType2D.Static; Debug.Log("Game over"); if (platformSystem != null) { platformSystem.GetComponent <PlatformSystem>().ResetPlatforms(); } if (points > browserCommunication._globalBestPoints) { browserCommunication._globalBestPoints = points; bestPoints = points; } else if (points > bestPoints) { bestPoints = points; } points = 0; transform.position = startPosition; cameraObject.GetComponent <CameraScript>().ResetPosition(); BrowserCommunication.SendData(points); }