- 수정됨
[Unity] Adding multiple materials to a mesh
Hi,
We've been using the Spine runtime for Unity for a few weeks now and have run into an issue with adding multiple materials to a single mesh after adding a Skeleton Animation component. When trying to modify the number of materials on the Mesh Renderer it reverts back to the default of 1. We also tried changing the number of materials on the atlas data but this doesn't seem to do what I think it does. This seems to be set somehow by the Spine data (perhaps the atlas file?) but we can't figure out where or how and was wondering if this was a bug or if there was a way of doing this. Thanks!
In what way are you trying to use multiple materials?
SkeletonComponent uses the data in AtlasAsset to find out where to find the regions specified in the json, and which materials to map them to.
You only set multiple materials in the AtlasAsset and only if you packed textures into multiple atlases.
Hmmm ok. I guess to give context this was really for use in shaders as having multiple materials is useful for various effects. So if I wanted to do this I would have to create multiple atlases and set them to be mapped across the whole skeleton in the AtlasAsset?
I haven't tried this.
Maybe you just need to access the AtlasAsset and change the shader in its material in code when you need to?
I'm not sure if that will work. Seems worth a shot.