2.5D games with URP

AC's 2.5D camera mode involves rendering the background and characters with separate cameras, and ovelaying them together.

Unity's Universal Render Pipeline uses its own technique to overlay multiple cameras, so this script will make the necessary changes to a 2.5D scene to allow it to work with URP.

To use it, paste the script below into a C# file named URP_25D.cs and attach it as a component to a GameObject in the scene: using UnityEngine.Rendering.Universal; using UnityEngine; using AC; public class URP_25D : MonoBehaviour { 	private void OnEnable  { EventManager.OnSwitchCamera += OnSwitchCamera; } private void OnDisable { EventManager.OnSwitchCamera -= OnSwitchCamera; } private void Awake { 		Camera backgroundCamera = BackgroundCamera.Instance.GetComponent ; var backgroundCameraData = backgroundCamera.GetUniversalAdditionalCameraData ; backgroundCameraData.renderType = CameraRenderType.Overlay; var mainCameraData = KickStarter.mainCamera.Camera.GetUniversalAdditionalCameraData ; if (!mainCameraData.cameraStack.Contains (backgroundCamera)) { 			mainCameraData.cameraStack.Add (backgroundCamera); } 	}  	private void Start { 		GameCamera25D[] gameCamera25Ds = FindObjectsOfType ; foreach (GameCamera25D gameCamera25D in gameCamera25Ds) { 			gameCamera25D.Camera.enabled = true; var cameraData = gameCamera25D.Camera.GetUniversalAdditionalCameraData ; cameraData.renderType = CameraRenderType.Overlay; } 	}  	private void OnSwitchCamera (_Camera fromCamera, _Camera toCamera, float transitionTime) { 		var mainCameraData = KickStarter.mainCamera.Camera.GetUniversalAdditionalCameraData ; if (fromCamera && mainCameraData.cameraStack.Contains (fromCamera.Camera)) { 			mainCameraData.cameraStack.Remove (fromCamera.Camera); } 		if (!mainCameraData.cameraStack.Contains (toCamera.Camera)) { 			var gameCameraData = toCamera.Camera.GetUniversalAdditionalCameraData ; gameCameraData.renderType = CameraRenderType.Overlay; mainCameraData.cameraStack.Add (toCamera.Camera); } 	}  }