Last active
September 16, 2018 14:41
-
-
Save kaiware007/b5c949caa358c88a1ed64b67da224ec6 to your computer and use it in GitHub Desktop.
Orthographicカメラの大きさいっぱいにTransformを拡縮するスクリプト(Unity3D)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public class ScreenAdjustTransform : MonoBehaviour { | |
public Camera targetCamera = null; | |
void AdjustScreen() | |
{ | |
float height = targetCamera.orthographicSize * 2; | |
float width = height * targetCamera.aspect; | |
transform.localScale = new Vector3(width, height, 1); | |
} | |
// Use this for initialization | |
void Start () { | |
AdjustScreen(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment