해상도 문제

이 글의 성격은 무엇인가요?

질문 / 문제 해결

내용을 설명해주세요

안녕하세요.

Unity에서 개발중 모바일 환경에서 텍스쳐의 해상도가 떨어져 보이는 문제가 있어서 이것저것 바꿔보았지만 해결방법을 못찾아서 질문글 남깁니다.

유니티는 6000.0.59 버전이고,
앱인토스 SDK는 1.6.0 버전입니다.

원래 모바일 앱으로 서비스하던 환경에서 정상적으로 보이던 이미지와 텍스트가 토스환경에서는 해상도가 낮아진것 처럼 보입니다.
원본 이미지의 MaxSize도 변경해보고, 포맷도 변경해보고, Quality값도 조정해보고, Rendering Color Space도 변경해보고 QualitySettings.globalTextureMipmapLimit값을 변경해봐도 모두 변화가 없습니다.

어떤게 문제이고 어떻게 해결해야 하는지 도움주시면 감사하겠습니다.

appName (선택)

memorytest

안녕하세요 :slight_smile:
앱인토스 유니티 SDK를 사용하시나요 ?
어떻게 .ait 빌드 하셨는지 설정값을 알고 싶습니다 !

Unity에서의 빌드 세팅은 아래 스샷과 같고,

최적화 코드로 다음을 적용하였습니다.

public class AppsInTossStartupOptimizer : MonoBehaviour {

    [Header("시작 최적화 설정")]

public bool enableFastStartup = true;

public bool preloadCriticalAssets = true;

public int maxConcurrentLoads = 3;




    [Header("앱인토스 연동")]

public bool enableTossLogin = true;

public bool preloadTossServices = false;




    [Header("메모리 최적화 설정")]

public bool enableStartupGC = true;

public bool unloadUnusedAssets = true;

public bool optimizeTextureMemory = true;




    [Header("앱인토스 메모리 제한")]

public long maxMemoryUsageMB = 200; // 앱인토스 권장 제한 (iOS는 100)




void Awake() {

if (enableFastStartup) {

OptimizeStartupSettings();

        }

if (enableStartupGC) {

StartCoroutine(OptimizeStartupMemory());

        }

//// 메모리 사전 최적화

// 텍스처 스트리밍 설정

QualitySettings.streamingMipmapsActive = true;

QualitySettings.streamingMipmapsMemoryBudget = 128; // MB




// 오디오 설정 최적화

var config = AudioSettings.GetConfiguration();

config.sampleRate = 22050; // 모바일에서는 낮은 샘플레이트

config.speakerMode = AudioSpeakerMode.Stereo;

AudioSettings.Reset(config);




    }




void OptimizeStartupSettings() {

// 프레임률 제한 설정 (초기 로딩 시)

Application.targetFrameRate = 30; // 배터리 절약




// Unity 서비스 지연 초기화

StartCoroutine(DelayedUnityServicesInit());




// 메모리 관리 최적화

System.GC.Collect();

Resources.UnloadUnusedAssets();




if (enableTossLogin) {

InitializeTossServices();

        }

    }




IEnumerator DelayedUnityServicesInit() {

// 첫 프레임 렌더링 후 Unity 서비스 초기화

yield return new WaitForEndOfFrame();




// Analytics, Cloud Build 등 지연 초기화

//InitializeUnityServices();

    }




void InitializeTossServices() {

// 토스 로그인 서비스 사전 초기화

StartCoroutine(PreloadTossAuthentication());

    }




IEnumerator PreloadTossAuthentication() {

// 토스페이 SDK 사전 로딩

yield return new WaitForSeconds(0.1f);




// AppsInToss 인증 토큰 검증

// AppsInToss.GetCurrentUserToken((token) => {

//     if (!string.IsNullOrEmpty(token)) {

//         Debug.Log("토스 인증 토큰 사전 로딩 완료");

//         // 사용자 프로필 캐시 로딩

//         StartCoroutine(CacheUserProfile(token));

//     }

// });

    }




IEnumerator CacheUserProfile(string token) {

// 사용자 프로필 정보 미리 캐시

// 게임 플레이 중 빠른 접근을 위함

yield return null; // 구현 필요

    }

#if UNITY_EDITOR

// Build Settings 최적화

    [MenuItem("AIT/Optimize Build Settings")]

static void OptimizeBuildSettings() {

// IL2CPP 설정 최적화

PlayerSettings.SetScriptingBackend(UnityEditor.Build.NamedBuildTarget.WebGL, ScriptingImplementation.IL2CPP);




// 코드 최적화 레벨

PlayerSettings.SetIl2CppCompilerConfiguration(UnityEditor.Build.NamedBuildTarget.WebGL, Il2CppCompilerConfiguration.Release);




// 불필요한 코드 제거

PlayerSettings.stripEngineCode = true;

PlayerSettings.SetManagedStrippingLevel(UnityEditor.Build.NamedBuildTarget.WebGL, ManagedStrippingLevel.High);




// 압축 설정

PlayerSettings.WebGL.compressionFormat = WebGLCompressionFormat.Brotli;

    }

#endif




IEnumerator OptimizeStartupMemory() {

Debug.Log("시작 시 메모리 최적화 시작");




// 1. 가비지 컬렉션 실행

if (enableStartupGC) {

System.GC.Collect();

System.GC.WaitForPendingFinalizers();

yield return new WaitForSeconds(0.1f);

        }




// 2. 사용하지 않는 에셋 언로드

if (unloadUnusedAssets) {

var unloadOp = Resources.UnloadUnusedAssets();

yield return unloadOp;

        }




// 3. 텍스처 메모리 최적화

if (optimizeTextureMemory) {

OptimizeTextureSettings();

        }




// 4. 메모리 사용량 체크

CheckMemoryUsage();




Debug.Log("시작 시 메모리 최적화 완료");

    }




void OptimizeTextureSettings() {

// 모바일 환경에 맞는 텍스처 설정 적용

QualitySettings.globalTextureMipmapLimit = 1; // 0:전체 해상도, 1:절반 해상도, 2:반의반해상도

QualitySettings.anisotropicFiltering = AnisotropicFiltering.Disable;




Debug.Log("텍스처 메모리 최적화 적용");

    }




void CheckMemoryUsage() {

long currentMemoryMB = UnityEngine.Profiling.Profiler.GetTotalAllocatedMemoryLong() / (1024 * 1024);




Debug.Log($"현재 메모리 사용량: {currentMemoryMB}MB");




if (currentMemoryMB > maxMemoryUsageMB) {

Debug.LogWarning($"메모리 사용량이 권장 제한을 초과: {currentMemoryMB}MB > {maxMemoryUsageMB}MB");




// 앱인토스에 메모리 경고 리포트

//AppsInToss.ReportPerformanceIssue("high_memory_startup", currentMemoryMB);




// 추가 메모리 정리 시도

StartCoroutine(AdditionalMemoryCleanup());

        }

    }




IEnumerator AdditionalMemoryCleanup() {

// 더 적극적인 메모리 정리

Resources.UnloadUnusedAssets();

System.GC.Collect();




yield return new WaitForSeconds(0.5f);




// 정리 후 재측정

long newMemoryMB = UnityEngine.Profiling.Profiler.GetTotalAllocatedMemoryLong() / (1024 * 1024);

Debug.Log($"메모리 정리 후 사용량: {newMemoryMB}MB");

    }

}
}

혹시 앱인토스 유니티 SDK 를 이용시에도 동일하게 해상도가 낮아지나요 ?

네, 실제 출시된 앱은 물론이고 QR코드로 테스트 할때도 동일합니다.


위 이미지를 비교해 보시면 되는데 왼쪽의 이미지처럼 선명하게 나오지 않고 오른쪽 이미지처럼 퀄리티가 떨어져서 보입니다. (텍스트도 마찬가지 입니다.)