ws
Size: a a a
ws
AF
SP
ws
ws
SP
AF
ws
SP
SP
ws
ws
enabled = false сделатьAF
AF
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraSizeController : MonoBehaviour {
[SerializeField] private Camera[] mainCameras;
//[SerializeField] private SpriteRenderer sRenderer;
[SerializeField] private GameObject sampleObject;
[SerializeField] private Orientation orientation = Orientation.Vertical;
void Awake() {
float newSize = 0;
if (orientation == Orientation.Vertical) {
newSize = sampleObject.transform.localScale.x * Screen.height / Screen.width * .5f;
} else {
newSize = sampleObject.transform.lossyScale.y / 2f;
}
foreach (Camera camera in mainCameras) {
camera.orthographicSize = newSize;
}
}
public enum Orientation {
Vertical,
Horizontal
}
}
AF
SP
TY
TY
SP
A