Skip to content

Instantly share code, notes, and snippets.

View TeamDevGame's full-sized avatar
🏠
Working from home

Dmitry TeamDevGame

🏠
Working from home
  • Team Developers
  • Russian
  • 14:30 (UTC +03:00)
View GitHub Profile
@TeamDevGame
TeamDevGame / CameraConstantWidth.cs
Created November 16, 2022 06:00 — 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;