This is a pretty old topic.
The answer depends on what you need, as the old AttachUnitySprite isn't always ideal.
Many of the current tools are accessible if you add the following using to the top of your script:
To convert a Sprite to a one-off Attachment that you can use on your Skeleton, you can use:
RegionAttachment newAttachment = yourSprite.ToRegionAttachment(materialWithSettingsYouWant);
To set it on the skeleton, you can call this:
Slot slot = skeleton.FindSlot("slot you want");
slot.Attachment = newAttachment;
If any animation or code is setting the slot attachment, it will overwrite the value you set, so you either need to remove other code that touches it, remove animation keys that touch it, or use
slot.Attachment = newAttachment every frame after everything else. This was true even with the old AttachUnitySprite method.
Note that your Sprite's backing texture needs to have the correct import settings or it won't work.