using System.Collections; using System.Collections.Generic; using UnityEngine; public class Camtrigger : MonoBehaviour { public Vector3 newCamPos; //new camera position CamController camControl; //reference to CamController script void Start() { camControl = Camera.main.GetComponent(); //getting CamController component } private void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.tag == "Player") //check if the player has entered the collider { //min and max position camControl.minPos += newCamPos; camControl.maxPos += newCamPos; } } }