アス比によるカメラsize調整対応
This commit is contained in:
parent
9d21a4c446
commit
deaa80ce64
|
|
@ -3034,6 +3034,7 @@ MonoBehaviour:
|
||||||
stageManager: {fileID: 1870432536}
|
stageManager: {fileID: 1870432536}
|
||||||
resultManager: {fileID: 5034752974072861423}
|
resultManager: {fileID: 5034752974072861423}
|
||||||
readyObject: {fileID: 978217474}
|
readyObject: {fileID: 978217474}
|
||||||
|
tutorialPopupObject: {fileID: 0}
|
||||||
isDebug: 0
|
isDebug: 0
|
||||||
--- !u!4 &1870432534
|
--- !u!4 &1870432534
|
||||||
Transform:
|
Transform:
|
||||||
|
|
@ -3574,7 +3575,7 @@ Camera:
|
||||||
far clip plane: 1000
|
far clip plane: 1000
|
||||||
field of view: 60
|
field of view: 60
|
||||||
orthographic: 1
|
orthographic: 1
|
||||||
orthographic size: 12.5
|
orthographic size: 13
|
||||||
m_Depth: -1
|
m_Depth: -1
|
||||||
m_CullingMask:
|
m_CullingMask:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
|
|
@ -3629,9 +3630,11 @@ MonoBehaviour:
|
||||||
m_GameObject: {fileID: 2055584752}
|
m_GameObject: {fileID: 2055584752}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_EditorHideFlags: 0
|
m_EditorHideFlags: 0
|
||||||
m_Script: {fileID: 11500000, guid: c11194ed6fd84a1f812fa2cfae75f873, type: 3}
|
m_Script: {fileID: 11500000, guid: f7c0cd9890704e088ce102977779d9e8, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
|
originalAspect: {x: 1242, y: 2208}
|
||||||
|
aspectScale: 0
|
||||||
--- !u!114 &2071735749 stripped
|
--- !u!114 &2071735749 stripped
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_CorrespondingSourceObject: {fileID: 2071735749, guid: 041c0f3d96c90d64094cc76c5c87c26f,
|
m_CorrespondingSourceObject: {fileID: 2071735749, guid: 041c0f3d96c90d64094cc76c5c87c26f,
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace MyGame.Scripts
|
||||||
|
{
|
||||||
|
[RequireComponent(typeof(Camera))]
|
||||||
|
public class GameCameraSizeChanger : MonoBehaviour
|
||||||
|
{
|
||||||
|
[SerializeField] private Vector2 originalAspect = new Vector2(1242f, 2208f);
|
||||||
|
[SerializeField, ReadOnly] private float aspectScale;
|
||||||
|
|
||||||
|
private float OriginalAspect => originalAspect.y / originalAspect.x; // 1.7786
|
||||||
|
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
var currentAspect = (float)Screen.height / Screen.width;
|
||||||
|
var camera = GetComponent<Camera>();
|
||||||
|
aspectScale = currentAspect / OriginalAspect;
|
||||||
|
camera.orthographicSize = aspectScale * camera.orthographicSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f7c0cd9890704e088ce102977779d9e8
|
||||||
|
timeCreated: 1656653466
|
||||||
Loading…
Reference in New Issue