void Update() { if (Input.GetKeyDown(KeyCode.Tab)) { NextTarget(); UI.GetComponent <TargetUI>().target = lTarget[targetsIndex]; } if (Input.GetMouseButton(1)) { myLookAt.UpdateTarget(lTarget[targetsIndex]); } else { myLookAt.UpdateTarget(player); } }