// Set Active public static void SetActive(bool active) { if (active) { gameObject.AddComponent <Rigidbody>(); rb = gameObject.GetComponent <Rigidbody>(); rigidbodyData.restoreRigidbody(rb); //playerControllerScr.rb = rb; Cameras.SetActive(true); CharacterHUD.SetActive(true); movementScr.enabled = true; gravityBodyScr.enabled = true; planetLocalDirections.enabled = true; objectInteractionsScr.enabled = true; collider.enabled = true; MeshRenderer.enabled = true; } else { Cameras.SetActive(false); CharacterHUD.SetActive(false); movementScr.enabled = false; gravityBodyScr.enabled = false; PlanetLocalDirections.enabled = false; objectInteractionsScr.enabled = false; collider.enabled = false; MeshRenderer.enabled = false; rigidbodyData.saveRigidbody(rb); GameObject.Destroy(rb); } }