프로퍼티 경로는 컨테이너 오브젝트 내의 프로퍼티 위치를 설명하는 문자열입니다.
프로퍼티 경로를 사용하여 특정 경로에서 오브젝트의 데이터를 가져오거나 설정하거나, 오브젝트의 하위 프로퍼티에 대한 방문자를 수락할 수 있습니다.
프로퍼티 경로는 문자열로 구성되며 루트 오브젝트에서 특정 프로퍼티 인스턴스를 결정합니다. 예를 들어 경로 foo.bar.baz[12]
는 foo
컨테이너 안에 중첩된 bar
컨테이너 안에 있는 baz
목록 컨테이너의 13번째 요소를 결정합니다.
프로퍼티 경로를 생성하고 조정하려면 Unity.Properties.PropertyPath
클래스를 사용합니다.
프로퍼티 경로를 사용하여 다음을 수행할 수 있습니다.
Unity.Properties.PropertyPath
는 변경할 수 없는 구조체 타입입니다. 문자열로 프로퍼티 경로를 구성하면 하위 문자열 추출을 위해 할당이 발생합니다.
다음 표에는 문자열로 프로퍼티 경로를 구성할 때의 할당 동작이 나와 있습니다.
String | 길이 | 할당 | 할당 이유 |
---|---|---|---|
"Path" |
1 | 0 | 문자열을 그대로 사용합니다. |
"Path.To" |
2 | 2 | 문자열을 두 부분으로 나눕니다. |
"Path.To[2]" |
3 | 3 | 문자열을 두 부분으로 나누고 인덱스를 추출합니다. |
"Path.To[2].My" |
4 | 4 | |
"Path.To[2].My.Value" |
5 | 6 | 추가 부분에 대한 배열을 할당합니다. |
다음 표에는 부분으로 프로퍼티 경로를 구성할 때의 할당 동작이 나와 있습니다.
String | 길이 | 할당 | 할당 이유 |
---|---|---|---|
PropertyPath.FromName("Path") |
1 | 0 | |
PropertyPath.AppendName(previous, "To") |
2 | 0 | |
PropertyPath.AppendIndex(previous, 2) |
3 | 0 | |
PropertyPath.AppendName(previous, "My") |
4 | 0 | |
PropertyPath.AppendName(previous, "Value") |
5 | 1 | 추가 부분에 대한 배열을 할당합니다. |
성능을 최적화하고 메모리 할당을 피하려면 다음과 같이 하십시오.
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.