I want that when I stretch out the BG the SklgrAgent should also stretch out
But when I stretch it out it doesn't follow:
I want that when I stretch out the BG the SklgrAgent should also stretch out
But when I stretch it out it doesn't follow:
@mrhoody213 You need to first setup the RectTransform bounds of your skeleton, e.g. via the SkeletonGraphic Inspector under Advanced - Match RectTransform with Mesh
Match
. Then change the Advanced - Layout Scale Mode
according to your needs.
See the documentation here for details:
https://esotericsoftware.com/spine-unity#Parameters
I change the anchor of the child "SklgrAgent" to stretch and now when I stretch the parent "BG" it follows but the position that I made in the child will change but I want it to be in fixed position like this:
Can a skeletongraphic be cut? because the spine asset is set to a full body but this UI that I'm make I want it like a picture frame cutout so I just mask it
mrhoody213 Yes, you can use Unity's RectMask2D component to achieve this. The sample scene Spine Examples/Other Examples/SpriteMask and RectMask2D
would be helpful for you. The scene is briefly shown at 19:53 in the following video:
mrhoody213 I change the anchor of the child "SklgrAgent" to stretch and now when I stretch the parent "BG" it follows but the position that I made in the child will change but I want it to be in fixed position like this:
You are indeed correct that the Edit Layout Bounds
functionality currently lacks a feature allowing you to customize the scaling-origin which is used during the fit-operation. I could reproduce that if the origin is at the bottom and you are framing the face, resizing the parent e.g. smaller horizontally scales the skeleton downwards and out of the frame. Moving the RectTransform
origin unfortunately can't be used to fix this either. While you could potentially create a parent RectTransform
hierarchy with respective anchors or AspectRatioFitters
, that's admittedly very complicated to control.
I've created an issue ticket to allow customizing the scale origin:
EsotericSoftware/spine-runtimes2482
You can subscribe to this ticket to get notifications upon updates.
@mrhoody213 FYI: We have just released this feature, allowing you to offset the skeleton mesh independently of the pivot.
From the changelog:
SkeletonGraphic: You can now offset the skeleton mesh relative to the pivot via a newly added green circle handle. This allows you to e.g. frame only the face of a skeleton inside a masked frame. Previously offsetting the pivot downwards fails when
Layout Scale Mode
scales the mesh smaller and towards the pivot (e.g. the feet) and thus out of the frame. Now you can keep the pivot in the center of theRectTransform
while offsetting only the mesh downwards, keeping the desired skeleton area (e.g. the face) centered while resizing. Moving the new larger green circle handle moves the mesh offset, while moving the blue pivot circle handle moves the pivot as usual.
A new spine-unity 4.2 unitypackage is available for download:
https://esotericsoftware.com/spine-unity-download