Project_WL/AgentScripts/WL803_Portrait.cs

43 lines
2.3 KiB
C#
Raw Normal View History

// WL803_Portrait.cs — #803 세로(포트레이트) 전용 전환 (에디트 모드 · ProjectSettings.asset 만 수정 · PD 결정 2026-09-07)
// unity command run_script --file AgentScripts/WL803_Portrait.cs --entry WL803_Portrait.Dump
// unity command run_script --file AgentScripts/WL803_Portrait.cs --entry WL803_Portrait.Apply (세로 전용)
// unity command run_script --file AgentScripts/WL803_Portrait.cs --entry WL803_Portrait.Revert (가로 자동회전 원복 = 09-07 이전 값)
// 근거: 이전 값 defaultScreenOrientation 4(AutoRotation) · Portrait 0 · PortraitUpsideDown 0 · LandscapeRight 1 · LandscapeLeft 1.
// 코드의 방향 참조는 Assets/Script/Util/SafeArea.cs 하나(Portrait 기본 · 가로일 때만 분기) → 세로 전용에서 그대로 동작.
using UnityEditor;
using UnityEngine;
public static class WL803_Portrait
{
public static object Dump()
{
return string.Format("defaultInterfaceOrientation={0} · autorotate Portrait={1} PortraitUpsideDown={2} LandscapeLeft={3} LandscapeRight={4} · animatedAutorotation={5}",
PlayerSettings.defaultInterfaceOrientation,
PlayerSettings.allowedAutorotateToPortrait, PlayerSettings.allowedAutorotateToPortraitUpsideDown,
PlayerSettings.allowedAutorotateToLandscapeLeft, PlayerSettings.allowedAutorotateToLandscapeRight,
PlayerSettings.useAnimatedAutorotation);
}
public static object Apply()
{
PlayerSettings.defaultInterfaceOrientation = UIOrientation.Portrait;
PlayerSettings.allowedAutorotateToPortrait = true;
PlayerSettings.allowedAutorotateToPortraitUpsideDown = false;
PlayerSettings.allowedAutorotateToLandscapeLeft = false;
PlayerSettings.allowedAutorotateToLandscapeRight = false;
AssetDatabase.SaveAssets();
return "APPLIED portrait-only → " + Dump();
}
public static object Revert()
{
PlayerSettings.defaultInterfaceOrientation = UIOrientation.AutoRotation;
PlayerSettings.allowedAutorotateToPortrait = false;
PlayerSettings.allowedAutorotateToPortraitUpsideDown = false;
PlayerSettings.allowedAutorotateToLandscapeLeft = true;
PlayerSettings.allowedAutorotateToLandscapeRight = true;
AssetDatabase.SaveAssets();
return "REVERTED landscape-autorotate → " + Dump();
}
}