title: Mathf.Clamp not working, does not restrict values
body: <p>Im trying to restrict the movement (for now the z-axis) of my camera through the script attached to its pivot to the boundaries of a pool table and this is my script so far for testing.</p>
  <pre><code>using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  
  public class cameraManager : MonoBehaviour
  {
  
      void Start()
      {
  
      }
  
      void Update()
      {
          Vector3 cameraPos = transform.position;
          cameraPos.z = Mathf.Clamp(transform.position.z, -25, -4);
  
      }
  
  } 
  </code></pre>
  <p>but what happens is that when I move the camera pivot using the movement keys through a script in another object; the camera pivot is not restricted and just goes beyond the set clamp. Did I miss something?</p>