instanceRoot | 要解压缩的预制件实例的根。 |
unpackMode | 解压缩最外层根,还是完全解压缩。 |
action | 用于此操作的交互模式。 |
将给定的预制件实例解压,以便将其替换为预制件资源的内容,同时保留所有重载值。
给定对象必须是预制件实例的根。
预制件资源的内容是您在预制件模式下打开它时看到的对象。在 PrefabUnpackMode 为 OutermostRoot 时解压缩,会将预制件实例替换为该内容。在 PrefabUnpackMode 为 Completely 时解压缩,还将解压作为解压缩内容的一部分的任何预制件实例,因此最终的结果只不过是常规的游戏对象,而没有预制件实例。
常规预制件或模型预制件的内容总是在根位置有一个常规游戏对象,所以将其中之一解压缩后,在根位置(预制件实例在前面)就会留下一个常规游戏对象。
预制件变体的内容在根位置有一个基本预制件的实例,所以在 PrefabUnpackMode 为 OutermostRoot 时将预制件变体解压缩将留下一个基本预制件的实例(其中预制件变体实例在基本预制件之前)。
如果给定对象不是预制件实例的根,或者如果它是预制件资源的一部分,则解压会抛出 ArgumentException。这不包括以预制件模式打开的预制件内容。
InteractionMode 确定是否应该可以撤销该操作。
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.