Sprite Editor 的 Secondary Textures 模块可以将其他纹理与已编辑的精灵相关联。然后,着色器可以对这些辅助纹理进行采样,从而对精灵应用其他效果,例如法线贴图。辅助纹理目前仅受精灵渲染器支持,不适用于其他渲染器组件。
要使用此功能,请从 Sprite Editor 窗口左上角的下拉菜单中选择 Secondary Textures 模块。
要添加新的辅助纹理 (Secondary Texture) 条目,请选择 Secondary Textures 面板右下角的“+”。最多可以向每个精灵或精灵图集添加八个辅助纹理。每个添加的辅助纹理都显示为列表上的一个条目,并包含两个字段:Name 和 Texture。
可在 Name 字段中输入辅助纹理的自定义名称。一些 Unity 包会建议一些可与它们的着色器一起使用的纹理名称。Name 字段右侧的下拉箭头显示了一个有效建议名称的列表。即使卸载了相关的包,建议的名称仍保留在下拉菜单中。
要选择辅助纹理使用的纹理,请将纹理资源直接拖到 Texture 字段上,或者通过选择字段右侧的圆圈打开 Object Picker 窗口。
对辅助纹理采样时所使用的 UV 坐标与主精灵纹理相同。请让辅助纹理与主精灵纹理保持一致,从而确保其他纹理效果可以正确显示。
要在主精灵纹理处于隐藏状态时在 Sprite Editor 窗口中预览辅助纹理,请在列表中选择一个条目。在 Secondary Textures 列表的外部单击来取消选择该条目,然后便会再次显示主精灵纹理。
要从列表中删除辅助纹理,请选择该纹理,然后选择窗口右下角的“-”按钮。
要将更改应用到已编辑的精灵,请选择工具栏上的 Apply。未设置名称或选择纹理的条目被视为无效,并会在应用更改时自动删除。
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.