When adding a custom material to a SpineSprite in Godot, it can sometimes cause hidden parts of the skeleton to become visible. This issue arises because the custom material might not respect the visibility settings of individual slots and attachments. To address this, you can use the SpineSlotNode to set materials for specific slots, ensuring that the visibility settings are preserved.
Here’s how you can do it:
Create a SpineSlotNode for each slot you want to customize:
- Right-click on your
SpineSprite node in the scene tree.
- Select
Add Child Node... and choose SpineSlotNode.
- Assign the slot name to the
SpineSlotNode in the inspector.
Assign the custom material to the SpineSlotNode:
- In the
Materials section of the SpineSlotNode, set your custom material.
- This will override the material for that specific slot while preserving the visibility settings.
Ensure the SpineSlotNode is a direct child of the SpineSprite:
- The
SpineSlotNode must be a direct child of the SpineSprite to function correctly.
Here is an example of how to set a custom material for a specific slot using GDScript:
extends SpineSprite
func _ready():
var slot_node = SpineSlotNode.new()
slot_node.slot_name = "your_slot_name"
slot_node.material = preload("res://path_to_your_material.tres")
add_child(slot_node)
By using SpineSlotNode, you can apply custom materials to specific slots without affecting the visibility of other parts of the skeleton.
For more detailed information, you can refer to the SpineSlotNode section in the spine-godot runtime documentation.