배움 저장소

[UE4] UI 최적화 본문

Dev/Unreal Engine4

[UE4] UI 최적화

시옷지읏 2021. 10. 30. 22:06
더보기

틀린 내용이 있다면 알려주세요

공부하며 작성한 글입니다!

 

 

최적화를 할 때 Profiler를 이용하자

 

Profiler Tool Reference

An overview on the Profiler Tool used to monitor game performance.

docs.unrealengine.com

 

Unreal Engine이 UI를 불러오는 방법이다.

Rrecursive Call Widget::Paint

Internally calls each Widget's Blueprint Tick & Native Tick

Rebuilds the Hit test grid ( 사용자가 UI를 사용하는지 확인)

add items to the element batcher in SlateRHIRenderer ( 렌더링)

 

1. UI를 평탄화하자. UI 내부적으로 각 컨테이너 안에 다른 컨테이너가 있을 때마다 또 함수를 호출해주어야 하며, V Table LookUp 해당 함수를 찾아야하는 과정이 있어 CPU Cache도 필요하다.

 

 

2.

visible을 사용하기 보다 [ HittestInvisible, SelfHittestInvisible ]를 활용하자. 뒤에 소개한 변수는 유저가 클릭할 수 있는 인터페이스를 만들지 않는다. Self는 자신만, Hit은 하위에 있는 요소에도 적용된다.

Deatils

3. 항상 업데이터될 필요가 없는 Widget는 Tick함수를 삭제한다. 그대신 Event Delegate를 사용하자.

BluePrint Tick과 C++ Code Tick 모두 삭제하고 Delegate와 BP내에 Event Listener로 대체한다.

 

4. UI의 특정 요소를 숨기고 싶을때 Hidden보다 COLLAPSED를 사용하자. UI를 표시할 때 각 요소의 위치가 계산되고 있다. Collapse를 사용하면 하위 요소에도 모두 적용된다.

 

 

 

5. 그외 찾은 것

  • Don't use any UMG bindings
  • Only set data when the data changes
  • Don't run any blueprint code
  • Put your widgets in invalidation boxes, use the widget reflector to make sure widgets only invalidate when they're updated ( invalidation box는 에러를 만들 수 있다. 안전하지 않음 )
  • Use materials to replace other changes you may make to images since that won't invalidate
Comments