[UE5] 궁금증 UStaticMesh vs UStaticMeshComponent

ChangJin·2024년 4월 13일
0

Unreal Engine5

목록 보기
47/102
post-thumbnail
  • UstaticMesh 와 UStaticMeshComponent의 차이점에 대해 찾아보다가 매우 좋은 언리얼 공식 사이트에 올라온 질문이 있어서 정리한다.

https://forums.unrealengine.com/t/setmaterial-via-ustaticmesh-vs-ustaticmeshcomponent/481483


SetMaterial

  • SetMaterial이란 메시의 엘리멘트에 적용된 material을 바꾸는 메소드이다.
  • Changes the material applied to an element of the mesh. the material used by the indexed element of this mesh.

  • 문제는 이 SetMaterial을 통해서 material을 바꿀때 UStaticMesh::SetMaterial()로 쓰는 것과 UStaticMeshComponent::SetMaterial()로 쓰는것의 차이가 도대체 무엇이냐 하는 것이다.

  • 정의는 다음과 같다.

StaticMesh

폴리곤의 정적인 집합으로 이러진 geometry의 조각들 이라고한다.

A StaticMesh is a piece of geometry that consists of a static set of polygons.

StaticMeshComponent

그러한 UStaticMesh의 인스턴스를 생성하는데 쓰인다.

StaticMeshComponent is used to create an instance of a UStaticMesh.


  • 여기까지보면 StaticMeshComponent::SetMaterial()을 써야하는것 아닌가? 싶은데 그렇지 않다. UStaticMesh::SetMaterial()을 써서 직접 UStaticMesh에 접근해 SetMaterial()을 할수도있다.

둘의 차이

  • UStaticMesh - then you change Asset configuration itself (common for many instances).

  • 그 자체 에셋의 configuration을 바꾼다.

  • UStatucMeshComponent - you just override it for some specific instance

  • 구체적인 인스턴스에 대해 단순히 override한다. 즉 덮어쓴다.

profile
Unreal Engine 클라이언트 개발자

0개의 댓글