Unity의 씬 포맷은 YAML 데이터 직렬화 언어로 구현되어 있습니다. 여기서는 YAML에 대해 자세히 다루지는 않지만, 이는 공개 포맷으로서 YAML 웹 사이트에서 누구나 사양을 확인할 수 있습니다. 씬 내 각 오브젝트는 씬 파일 안에 YAML document 형태로 각각 저장됩니다(이는 해당 파일에 — 시퀀스로 시작하는 형태로 저장됩니다). 위의 문장에서 “오브젝트”는 게임 오브젝트, 컴포넌트, 또는 다른 씬 데이터를 포괄하는 개념입니다. 이들은 각각 씬 파일 내에서 각자의 YAML document를 필요로 합니다. 직렬화된 오브젝트의 기본적인 구조는 다음 예제를 통해 이해할 수 있습니다.
--- !u!1 &6
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
importerVersion: 3
m_Component:
- 4: {fileID: 8}
- 33: {fileID: 12}
- 65: {fileID: 13}
- 23: {fileID: 11}
m_Layer: 0
m_Name: Cube
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
첫 번째 줄은 문서 마커 이후에 “!u!1 &6” 문자열을 포함하고 있습니다. “!u!” 부분 이후 나타나는 첫 번째 숫자는 오브젝트의 클래스를 나타내며, 이 경우에는 게임 오브젝트입니다. 앰퍼샌드 기호(&) 다음에 나타나는 숫자는 파일에서 고유한 오브젝트 ID 번호이며, 이 숫자는 각 오브젝트에 임의로 할당됩니다. 각 오브젝트의 직렬화 가능한 프로퍼티는 다음과 같은 행으로 표시됩니다.
m_Name: Cube
일반적으로 프로퍼티는 “m_”으로 시작하는 접두사를 가지며, 그렇지 않은 경우 스크립트 레퍼런스에서 정의된 프로퍼티의 이름을 따릅니다. 파일 아래쪽에 정의된 두 번째 오브젝트는 다음과 같이 표시될 수 있습니다.
--- !u!4 &8
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 6}
m_LocalRotation: {x: 0.000000, y: 0.000000, z: 0.000000, w: 1.000000}
m_LocalPosition: {x: -2.618721, y: 1.028581, z: 1.131627}
m_LocalScale: {x: 1.000000, y: 1.000000, z: 1.000000}
m_Children: []
m_Father: {fileID: 0}
이것은 위의 YAML 문서에서 정의된 게임 오브젝트에 연결된 Transform 컴포넌트입니다. 다음 행에서 연결이 표시됩니다.
m_GameObject: {fileID: 6}
이는 파일에 있는 게임 오브젝트의 오브젝트 ID가 6이기 때문입니다.
부동 소수점 숫자는 10진수, 또는 IEEE 754 포맷(0x 접두사를 가짐) 16진수로 표현할 수 있습니다. IEEE 754 표현 방법은 값을 손실 없이 인코딩하는 데 사용되며, Unity는 이를 긴 소수점 아래 숫자가 있는 부동 소수점 숫자를 작성하는 경우 사용합니다. Unity가 숫자를 16진법으로 작성하는 경우 디버깅을 위해 괄호 안에 10진수로 동시에 작성하지만 전자만 파일을 로딩할 때 파싱됩니다. 이 값을 수동으로 편집하려면 16진수를 삭제하고 10진수만 입력해야 합니다. 다음은 부동 소수점 값을 유효하게 표현할 수 있는 방법의 예로, 모두 1을 나타냅니다.
myValue: 0x3F800000
myValue: 1
myValue: 1.000
myValue: 0x3f800000(1)
myValue: 0.1e1
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.