반응형 ui 적용
|
|
@ -0,0 +1,59 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class ScreenMove : MonoBehaviour
|
||||||
|
{
|
||||||
|
[SerializeField] RectTransform rectTransform;
|
||||||
|
[SerializeField] RectTransform test_rectTransform;
|
||||||
|
|
||||||
|
readonly Vector2 stretch = new Vector2(0f, 0.5f);
|
||||||
|
readonly Vector2 middle = new Vector2(1f, 0.5f);
|
||||||
|
readonly Vector2 center = new Vector2(0.5f, 0.5f);
|
||||||
|
readonly Vector2 movePos = new Vector2(-58.5f, 20f);
|
||||||
|
readonly Vector2 moveSize = new Vector2(-343f, 100f);
|
||||||
|
readonly Vector2 idlePos = new Vector2(-58.5f, 20f);
|
||||||
|
readonly Vector2 idleSize = new Vector2(553f, 100f);
|
||||||
|
bool isMobile;
|
||||||
|
void Awake()
|
||||||
|
{
|
||||||
|
isMobile = Application.isMobilePlatform;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
//모바일은 한번만 업데이트
|
||||||
|
if (isMobile)
|
||||||
|
{
|
||||||
|
rectTransform.sizeDelta = new Vector2(Screen.width, Screen.height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Update()
|
||||||
|
{
|
||||||
|
//pc는 실시간 업데이트
|
||||||
|
if (!isMobile)
|
||||||
|
{
|
||||||
|
rectTransform.sizeDelta = new Vector2(Screen.width, Screen.height);
|
||||||
|
//1280
|
||||||
|
//Debug.Log($"{Screen.width} : {Screen.height}");
|
||||||
|
if (Screen.width < 1280)
|
||||||
|
{
|
||||||
|
test_rectTransform.anchorMin = center;
|
||||||
|
test_rectTransform.anchorMax = center;
|
||||||
|
test_rectTransform.anchoredPosition = idlePos;
|
||||||
|
test_rectTransform.sizeDelta = idleSize;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
test_rectTransform.anchorMin = stretch;
|
||||||
|
test_rectTransform.anchorMax = middle;
|
||||||
|
test_rectTransform.anchoredPosition = movePos;
|
||||||
|
test_rectTransform.sizeDelta = moveSize;
|
||||||
|
}
|
||||||
|
//Debug.Log($"{test_rectTransform.anchoredPosition} : {test_rectTransform.sizeDelta}");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 8.3 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 437 KiB |
|
After Width: | Height: | Size: 66 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 795 B |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 687 B |
|
|
@ -407,7 +407,7 @@ PlayerSettings:
|
||||||
m_APIs: 10000000
|
m_APIs: 10000000
|
||||||
m_Automatic: 1
|
m_Automatic: 1
|
||||||
m_BuildTargetVRSettings: []
|
m_BuildTargetVRSettings: []
|
||||||
m_DefaultShaderChunkSizeInMB: 16
|
m_DefaultShaderChunkSizeInMB: 32
|
||||||
m_DefaultShaderChunkCount: 0
|
m_DefaultShaderChunkCount: 0
|
||||||
openGLRequireES31: 0
|
openGLRequireES31: 0
|
||||||
openGLRequireES31AEP: 0
|
openGLRequireES31AEP: 0
|
||||||
|
|
|
||||||