TMP Material 복제
- TMP의 인스펙터창에서 Material Preset을 변경할 수 있다.
- 인스펙터창의 아래에 있는 Material 을 복사 해 여러개의 Material을 만들 수 있다.
- 서로 다른 색상의 Glow를 적용시킨 Material을 여러개 만들어두었다.
- 머터리얼은 인스펙터창에서 바꿀 수 있다.
코드에서 Material 바꾸기
- 인스펙터 창에 다음과 같이 사용할 Material을 등록할 수 있도록 해주었다.
- 필드 설명
- 매개변수 name, dialog : string, 화면에 띄우는 내용을 담고 있음
- _name : TextMeshProUGUI, name의 내용을 띄우는 TMP를 인스펙터창에서 _name에 할당함
- name과 일치하는 Material의 ID를 찾는다.
- 변경하고자 하는 TMP의 fontMaterial을 변경한다.
(참고) TextMesh Pro Documentaion
Namespace: TMPro / Inherits from: MonoBehaviour
설명
A script interface for the TextMeshPro component.
See Also: TextMeshPro component.
속성
더보기
alignment | How lines of text are aligned (Left, Right, Center, Justified). |
anchor | Which point of the text shares the position of the Transform. |
anchorDampening | Prevents the anchor position from being adjusted unless the change exceeds 40% of the width of the underline character. |
bounds | The bounds of the text object. (Read-only) |
color | The default vertex color assigned to each character. Note: Color tags will override this default color unless overrideColorTags is set to true. |
characterSpacing | The amount of additional spacing between individual characters. |
extraPadding | Increases the size of the geometry for each character. It does not affect spacing between characters. Extra padding may be necessary when displaying small text to prevent clipping. |
enableKerning | Enables or disables kerning. |
enableWordWrapping | Enables or disables word wrapping. When disabled, the text will be displayed on a single line. |
faceColor | The color of the "_FaceColor" property of the material. Changing faceColor will result in an instance of the material. |
font | The TextMeshPro font asset used. |
fontMaterial | The material assigned to this text object. Assigning a material will result in an instance of the material. |
fontSharedMaterial | The material assigned to this text object. Using fontSharedMaterial will not result in an instance of the material. |
fontSize | The font size to use. |
horizontalMapping | Controls how the face and outline textures will be applied to the text object. |
isOverlay | Sets the RenderQueue along with Ztest to force the text to be drawn last and on top of scene elements. |
lineLength | Determines where word wrapping will occur. |
lineSpacing | The amount of additional spacing to be added between each lines of text. |
outlineColor | The color of the "_OutlineColor" property of the material. Changing outlineColor will result in an instance of the material. |
outlineWidth | The thickness of the characters outline. Setting this value will result in an instance of the font material. |
overrideColorTags | Overrides the color tags forcing the vertex colors to be the default font color. |
text | The text to be displayed. |
verticalMapping | Controls how the face and outline textures will be applied to the text object. |
매소드
더보기
SetCharArray | Character array containing the text to be displayed. |
SetText | Formatted string containing a pattern and a value representing the text to be displayed. |
UpdateMeshPadding | Function forcing a re-computation of the required mesh padding based on the material properties to prevent clipping. |