I need to combine both camera that follows the player and the camera shake effect in the same moment. The problem is in that, if I make the shake effect for the camera, then the camera doesn't follow the player and if I make the camera follow the player, then the shake effect doesn't appear. The basic idea of my script is next:`
Vector3 originalPos; GameObject targetPlayer; bool canShake; void OnEnable() { originalPos = camTransform.localPosition; } void Update() { // Camera shakes if (CanShake) { transform.localPosition = originalPos + Random.insideUnitSphere * shakeAmount; } // Camera follows the player else { transform.position = new Vector3(targetPlayer.transform.position.x, transform.position.y, transform.position.z; } } Does anyone have ideas how to combine these two things (camera shake effect and camera that follows the player) at the same moment?