現在の SkeletonGraphicCustomMaterialsコンポーネントはSkeletonRendererCustomMaterialsほど強力ではなく、ドキュメントにはまだ明示的に記載されていません。
残念ながら、 SkeletonGraphicとSkeletonGraphicCustomMaterialsは、 SkeletonRendererのように、スロットごとのカスタムマテリアルをまだサポートしていません。
この機能の発行チケットをここに作成しました。
https://github.com/EsotericSoftware/spine-runtimes/issues/1982
残念ながら、レンダリング関連のコードにいくつかの変更が必要なため、4.1ベータブランチでの実装になります。
この機能が実装されるまでは、次の回避策のいずれかを使用できます。
特別なマテリアルが必要な画像を別のアトラステクスチャにパックします。次に、 SkeletonGraphicCustomMaterialsコンポーネントを使用して、このテクスチャでマテリアルをオーバーライドします。
非推奨:「セパレータースロット」機能を使用して、スケルトンを3つ以上の部分に分割します。そして、2番目の部分の CanvasRendererでマテリアルをオーバーライドできます。ただしこれには、SkeletonGraphic.OnMeshAndMaterialsUpdatedコールバックデリゲートを使用して、適切なタイミングでマテリアルを設定する必要がある場合があります。
We are sorry that the current SkeletonGraphicCustomMaterials component is not as powerful as SkeletonRendererCustomMaterials and that the documentation does not explicitly state this yet.
Unfortunately SkeletonGraphic and SkeletonGraphicCustomMaterials do not yet support custom Materials per Slot as SkeletonRenderer does.
I have created an issue ticket here for this feature:
https://github.com/EsotericSoftware/spine-runtimes/issues/1982
Unfortunately it will be implemented on the 4.1-beta branch, since it requires some changes to the rendering-related code.
Until the feature is implemented, you could use one of the following workarounds:
-
Pack images that need a special material to a separate atlas texture. Then you use the SkeletonGraphicCustomMaterials component to override the Material at this texture.
-
Not recommended: Use the Separator Slots feature to separate the skeleton into three or more parts. Then you can override the Material at the second part's CanvasRenderer, but this might require using the SkeletonGraphic.OnMeshAndMaterialsUpdated callback delegate to set the material at the right time.