public void OnAssignedVehicle(Vehicle vehicle) { Debug.Log("Received a new vehicle:" + vehicle.name); if (hud == null) { var hudObject = Instantiate(hudPrefab) as GameObject; hud = hudObject.GetComponentInChildren <PlayerHud>(); hud.quitMinigameButton.gameObject.SetActiveRecursively1(false); minimap = hud.GetComponentInChildren <Minimap>(); subtitles = hud.GetComponentInChildren <Subtitles>(); var playerCamera = SetupGameplayCamera(vehicle.gameObject, vehicle.transform); minimap.cameraToFollow = playerCamera.GetComponent <Camera>(); var avatarQuest = vehicle.GetComponentInChildren <AvatarQuest>(); if (avatarQuest != null) { var minimapCamera = hud.GetComponentInChildren <MinimapCamera>(); minimapCamera.objectToFollow = avatarQuest; var minimapSurface = hud.GetComponentInChildren <MinimapSurface>(); minimapSurface.avatarToFollow = avatarQuest; } } }