assetObject | 表示您要查询其状态的资源的对象。 |
assetOrMetaFilePath | 磁盘上资源文件或其 .meta 文件的路径,相对于项目文件夹。 |
message | 返回资源未处于可编辑状态的原因。 |
statusOptions | 版本控制系统应如何进行查询的选项。这些选项会影响查询的速度和准确性。默认值为 StatusQueryOptions.UseCachedIfPossible。 |
bool 如果所选版本控制系统认为资源处于可编辑状态,则为真。
查询资源文件在版本控制中是否处于可编辑状态。
您的版本控制系统可能配置为一次仅允许单个用户编辑某些类型的文件,以避免多个用户同时编辑一个文件时发生的冲突。在这种情况下,用户必须“打开”该文件进行编辑(也称为“签出”),以确保他们有权编辑该文件。使用此函数查询版本控制系统中文件的“可编辑状态”,前提是该版本控制系统支持此功能。
位于 Unity 项目文件夹外部或未在版本控制文件夹(例如,“Library”或“Temp”)下的文件路径始终被视为处于可编辑状态。对于这些路径,IsOpenForEdit
返回 true
。
引用非本地 Package 文件夹的文件路径始终被视为不可编辑。对于这些路径,IsOpenForEdit
返回 false
。
当没有激活版本控制系统时,项目内部的所有文件路径都被视为处于可编辑状态。
当激活版本控制系统时,例如在 Perforce VCS 下,“已添加”和“已在本地签出”的文件被视为处于可编辑状态,而其他文件则不是。
其他资源:AssetDatabase.IsMetaFileOpenForEdit、StatusQueryOptions、AssetDatabase.MakeEditable。
assetOrMetaFilePaths | 资源或其 .meta 文件的路径,相对于项目文件夹。 |
outNotEditablePaths | 不可编辑资源路径的目标列表。 |
statusQueryOptions | 指定 Unity 应如何查询版本控制系统。默认值为 StatusQueryOptions.UseCachedIfPossible。 |
查询提供的资源文件中哪些在版本控制中处于可编辑状态。
此 IsOpenForEdit
函数的变体可以一次查询多个资源路径。它将未“打开以进行编辑”的资源的路径写入 outNotEditablePaths
列表中。
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.