要将预制件实例的内容恢复到常规游戏对象,请解压缩预制件实例。此操作正是创建(打包)预制件的相反操作,不同之处在于此操作不会破坏预制件资源,而是仅影响预制件实例。
可通过在 Hierarchy 窗口中右键单击预制件实例并选择 Unpack Prefab 来解压缩预制件实例。场景中生成的游戏对象不再与其以前的预制件资源有任何关联。预制件资源本身不受此操作的影响,并且您的项目中可能还有它的其他实例。
如果在解压缩之前在预制件实例上有任何覆盖,这些覆盖将被“烘焙”到生成的游戏对象上。也就是说,值将保持不变,但不再具有覆盖状态,因为没有需要覆盖的预制件。
如果解压缩内含嵌套预制件的预制件,则嵌套的预制件仍然是预制件实例,并且仍然关联到它们各自的预制件资源。同样,如果解压缩预制件变体,根部将会有一个新的预制件实例,即基础预制件的实例。
通常,解压缩预制件实例后生成的对象与您进入该预制件的预制件模式时看到的对象相同。这是因为预制件模式会显示预制件内部的内容,而解压缩预制件实例会解压缩预制件的内容。
如果希望将预制件实例替换为普通游戏对象并完全消除与所有预制件资源的所有关联性,则可以在 Hierarchy 窗口中右键单击该预制件实例,然后选择 Unpack Prefab Completely。此做法相当于解压缩预制件,并继续解压缩原先作为嵌套预制件或基础预制件出现的所有预制件实例。
可以解压缩场景中存在的预制件实例,或者存在于其他预制件中的预制件实例。
2018–07–31 页面已发布
在 2018.3 版中添加了嵌套预制件和预制件变体
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.