Skip to content

Instantly share code, notes, and snippets.

View MitchPen's full-sized avatar

Mitch Pen MitchPen

View GitHub Profile
@MitchPen
MitchPen / CameraConstantWidth.cs
Created October 13, 2021 21:50 — forked from Glavak/CameraConstantWidth.cs
Скрипт для поддержания постоянной ширины камеры в Unity, для туториала https://youtu.be/0cmxFjP375Y
using UnityEngine;
/// <summary>
/// Keeps constant camera width instead of height, works for both Orthographic & Perspective cameras
/// Made for tutorial https://youtu.be/0cmxFjP375Y
/// </summary>
public class CameraConstantWidth : MonoBehaviour
{
public Vector2 DefaultResolution = new Vector2(720, 1280);
[Range(0f, 1f)] public float WidthOrHeight = 0;