블로그 이미지
Every unexpected event is a path to learning for you. blueasa

카테고리

분류 전체보기 (2811)
Unity3D (867)
Programming (479)
Server (33)
Unreal (4)
Gamebryo (56)
Tip & Tech (234)
협업 (61)
3DS Max (3)
Game (12)
Utility (140)
Etc (98)
Link (32)
Portfolio (19)
Subject (90)
iOS,OSX (55)
Android (16)
Linux (5)
잉여 프로젝트 (2)
게임이야기 (3)
Memories (20)
Interest (38)
Thinking (38)
한글 (30)
PaperCraft (5)
Animation (408)
Wallpaper (2)
재테크 (18)
Exercise (3)
나만의 맛집 (3)
냥이 (10)
육아 (16)
Total
Today
Yesterday

Unity 2021.3.42f1

----

 

[참고]

[링크] https://blueasa.tistory.com/2853

 

위 링크의 내용을 한 번 해보고,

안되면 아래 스크립트를 사용해 보자.

----

 

에디터의 GameView에서 Resolution을 비율이 아닌 해상도를 선택(예:1920x1080 Landscape)하면 Scale 때문에 한화면에 다 보이지 않는다.

그래서 Scale을 최소치로 내리는데, 문제는 Play를 실행하면 최소치로 내려놓은 Scale 값이 초기화되면서 화면이 다시 커진다.

그래서 Play 이후에 다시 Scale 값을 내리는 불편함이 생기는데, 찾아보니 같은 불편을 느끼는 사람이 많은 것 같다.

아래와 같은 스크립트를 만들어놨길래 써보니 꽤 마음에 든다.

 

아래 스크립트를 Editor 폴더에 넣어주기만 하면 된다.

using System;
using System.Reflection;
using UnityEditor;
using UnityEngine;
using Object = UnityEngine.Object;

[InitializeOnLoad]
public static class FixResolutionScale
{
    static FixResolutionScale()
    {
        EditorApplication.playModeStateChanged += OnPlayStateChanged;
        SetGameViewScale();
    }

    private static void OnPlayStateChanged(PlayModeStateChange playModeStateChange)
    {
        SetGameViewScale();
    }

    private static void SetGameViewScale()
    {
        Type gameViewType = GetGameViewType();
        EditorWindow gameViewWindow = GetGameViewWindow(gameViewType);

        if (gameViewWindow == null)
        {
            Debug.LogError("GameView is null!");
            return;
        }

        var defScaleField = gameViewType.GetField("m_defaultScale", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);

        //whatever scale you want when you click on play
        float defaultScale = 0.1f;

        var areaField = gameViewType.GetField("m_ZoomArea", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
        var areaObj = areaField.GetValue(gameViewWindow);

        var scaleField = areaObj.GetType().GetField("m_Scale", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
        scaleField.SetValue(areaObj, new Vector2(defaultScale, defaultScale));
    }

    private static Type GetGameViewType()
    {
        Assembly unityEditorAssembly = typeof(EditorWindow).Assembly;
        Type gameViewType = unityEditorAssembly.GetType("UnityEditor.GameView");
        return gameViewType;
    }

    private static EditorWindow GetGameViewWindow(Type gameViewType)
    {
        Object[] obj = Resources.FindObjectsOfTypeAll(gameViewType);
        if (obj.Length > 0)
        {
            return obj[0] as EditorWindow;
        }
        return null;
    }
}

 

 

 

[출처] https://discussions.unity.com/t/game-view-scale-on-compilation-play/217998

 

반응형
Posted by blueasa
, |

[링크] https://learnandcreate.tistory.com/642

 

유니티에서 패키지를 기본값으로 재설정하기(reset pacakges to defaults)

유니티에서 패키지를 기본값으로 재설정하기(reset pacakges to defaults) 패키지를 기본값으로 재설정하면 프로젝트에서 사용자가 설치한 모든 패키지들을 제거하고 기본값으로 초기화합니다. 이 작

learnandcreate.tistory.com

 

반응형
Posted by blueasa
, |

조치 방법은 일단 visual Studio IDE 를 삭제하고 다시 설치하는 방법이 있구요..(최악의 방법이자 뒷탈없는 방법이죠.)

 

다음으로는 Visual Studio IDE를 리셋 하는 방법입니다..

관련정보는 http://www.microsoft.com/korea/msdn/library/ko-kr/bb245788(vs.80).aspx

  • Visual Studio 2005의 인스턴스를 모두 종료합니다.
  • 시작을 클릭하고 실행...을 선택합니다.
  • "devenv.exe /resetuserdata"를 입력합니다.
이 명령을 사용하면 몇 분 동안 Visual Studio가 정리되고 처음 상태로 설정됩니다. 이때 작업 관리자를 열어 devenv.exe 프로세스가 실행 중인지 여부를 확인할 수 있습니다. 실행이 종료되면 Visual Studio를 다시 시작할 수 있습니다. 그러면 컴퓨터에서 Visual Studio를 처음으로 실행할 때처럼 처음 실행 대화 상자가 다시 표시됩니다.

반응형
Posted by blueasa
, |