Upload
-
View
730
Download
2
Embed Size (px)
Citation preview
뭣이중헌디? 성능프로파일도모름서
유니티성능프로파일링가이드
Inven Game Conference
유니티테크놀로지스코리아 오지현
뭣이 중헌디?
프로파일링?
Texture Size ?Pixel Shader ?
Draw Call ?Physics ?
Memory ?
1 프로파일링?
병목탐지!
병목제거!
프로파일링!
1
프로파일링이
중헌지도 모름서!
“ ”
성능 프로파일링... 언제 ?
개발 후반부 ?- 수정이 불가능
개발 초반부 ?- 성능 측정 불필요- 특히 프로토타이핑 시점
개발중반부부터
주기적으로
툴의도움없이는빠른진행이어려움
INDEX1
Chapter유니티프로파일러 Unity Profiler
2
Chapter프레임디버거 Frame Debugger
3
Chapter메모리프로파일러 Memory Profiler
4
Chapter엑스코드 Xcode - Instrument
5
Chapter쓰로틀링 Throttling
Chpater [1]
유니티 프로파일러
Inven Game Conference
Unity > Window > Profiler
https://docs.unity3d.com/Manual/Profiler.html
* PC와 디바이스를동일 네트워크 WiFi에 위치
디바이스에 연결해서 확인에디터상에서 돌아가는 게임을 확인하는 것은 의미 없음
1 Unity Profiler
1 Unity Profiler
21 FPS , Rez : 2560x1440
1 Unity Profiler
1 Unity Profiler
Frame End
CPU
GPU
CPU boundary VS GPU boundary
Frame Start
1 Unity Profiler
Frame End
CPU
GPU
CPU boundary VS GPU boundary
Frame Start
1 Unity Profiler
6 FPS , Rez : 2560x1440
1 Unity Profiler
1 Unity Profiler
Chpater [2]
프레임 디버거
Inven Game Conference
Unity > Window > Frame Debugger
2 Frame Debugger
2 Frame Debugger
2 Frame Debugger
2 Frame Debugger
2 Frame Debugger
2 Frame Debugger
2 Frame Debugger
2 Frame Debugger
2 Frame Debugger
2 Frame Debugger
Sprite, UI 배칭의 영향 요인들
• Sorting Layer• Order in Layer• Sprite Packing• Position Z• Hierarchy• Canvas• Shader• 등등
Chpater [3]
메모리 프로파일러
Inven Game Conference
https://bitbucket.org/Unity-Technologies/memoryprofilerProfiler
https://bitbucket.org/Unity-Technologies/
3 Memory Profiler
• 유니티 5.3 이상• 다운로드 받은 프로젝트의 Editor 폴더를 작업중인
프로젝트의 Editor 폴더로 드래그앤드랍 후 이름 변경
• 스크립트 백엔드 : IL2CPP (5.3 안드로이드!?)
• 디벨롭먼트 빌드로 실행• 유니티 프로파일러 윈도우 실행 및 디바이스 연결• Window > MemoryProfiler
3 Memory Profiler
누르고 인내심 필요 ㅠㅠ
3 Memory Profiler
3 Memory Profiler
3 Memory Profiler
3 Memory Profiler
Android의 Compressed:
RGB 텍스쳐 -> ETC1RGBA 텍스쳐 -> ETC2
ETC2는 OpenGL ES3.0부터 지원
OpenGL ES2.0에서 ETC2 사용 시->압축이 풀려서 메모리에 적재
3 Memory Profiler
ES3.0 지원 기기:4MB
3 Memory Profiler
ES2.0 기기가 타겟이라면,
(Sprite, UI 에서만 지원. Packing Tag 필수)
3 Memory Profiler
using UnityEditor;
public class ResourceModifierTest : AssetPostprocessor {
void OnPreprocessTexture()
{
var importer = (assetImporter as TextureImporter);
if( importer.textureType == TextureImporterType.Sprite) {
importer.SetPlatformTextureSettings(
"Android", 1024, TextureImporterFormat.AutomaticCompressed);
importer.SetPlatformTextureSettings(
"iPhone", 1024, TextureImporterFormat.AutomaticCompressed);
importer.SetAllowsAlphaSplitting( true);
importer.mipmapEnabled = false;
}
}
}
3 Memory Profiler
3 Memory Profiler
Decompress On Load
오디오 압축 풀려서 메모리에 적재BGM처럼 큰 오디오에는 치명적작은 효과음만 사용
iOS에서 Vorbis를 사용해도 마찬가지iOS에서는 OGG 네이티브 지원 XiOS에서는 MP3 사용 권장
3 Memory Profiler
3 Memory Profiler
중복 리소스
유니티는 중폭 파일 체크 XFont, Audio, Texture ...
에셋 번들 사용시에도 주의AssetBundle.Unload(false) ?Unity - AssetBundle usage patterns
Memory Profiler로 실수들 확인 가능
3 Memory Profiler
3 Memory Profiler
3 Memory Profiler
using UnityEditor;
public class ResourceModifierTest : AssetPostprocessor {
void OnPreprocessModel () {var importer = (assetImporter as ModelImporter);importer.isReadable = false;importer.optimizeMesh = true;if (assetPath.Contains("@")) {
importer.importMaterials = false;}
}
}
3 Memory Profiler
Chpater [4]
엑스코드
Inven Game Conference
CPU Profiling – Instrument
https://blogs.unity3d.com/kr/2016/02/01/profiling-with-instruments/
4 Xcode
4 Xcode
Xcode > Product > Profile > Instrument
4 Xcode
4 Xcode
CharacterBehavior_Update_m3719746460
클래스명 메서드명 UID
4 Xcode
4 Xcode
public static class ExtensionMethods
{
public static bool HasParameterOfType (this Animator self, string name, AnimatorControllerParameterType type)
{
var parameters = self.parameters;foreach (var currParam in parameters) {
if (currParam.type == type && currParam.name == name) {
return true;
}
}
return false;
}
}
5%?!
4 Xcode
GPU Profiling
4 Xcode
Xcode > Product > Scheme > Edit Scheme
4 Xcode
VertexPixel
4 Xcode
Vertex Pixel
4 Xcode
4 Xcode
4 Xcode
4 Xcode
4 Xcode
4 Xcode
마지막으로 ...
쓰로틀링
Inven Game Conference
데이터를 어지럽히는 주범일부 기기는 끄기 가능
쓰로틀링 Throttling
5 Throttling
5 Throttling
유니티프리미엄기술지원-기업대상유료서비스-전문가의프로젝트리뷰및컨설팅-유니티버그우선순위해결-상품문의 : [email protected]
유니티개발자포럼-페이스북유니티개발자커뮤니티
https://www.facebook.com/groups/unitykorea
-네이버카페유니티허브http://cafe.naver.com/unityhub
-유니티포럼https://forum.unity3d.com/
감사합니다
[ 유니티테크놀로지스코리아 / 차장 ]
오 지 현