Hi, I want to know if it is possible to get a position of a point in a sprite shape controller Component
through code.
For example:
Let’s say I selected this node:

How can I get the X and Y value through code?

Thank you very much!
Hi, I want to know if it is possible to get a position of a point in a sprite shape controller Component
through code.
For example:
Let’s say I selected this node:

How can I get the X and Y value through code?

Thank you very much!
Hello, have you found an answer to your question?
Else you can try out Spline’s
Vector3 GetPosition(int index)
accessible through SpriteShapeController and see if that works for you
More info here:
https://docs.unity3d.com/Packages/com.unity.2d.spriteshape@1.0/api/UnityEngine.U2D.SpriteShapeController.html#UnityEngine_U2D_SpriteShapeController_spline
https://docs.unity3d.com/Packages/com.unity.2d.spriteshape@8.0/api/UnityEngine.U2D.Spline.html#UnityEngine_U2D_Spline_GetPosition_System_Int32_
Hello, thank you for your asnwer!
I realized that I can get the position through the Spline, but I need the index of the point.
I think I expressed myself badly, because actually I need to find out what the index is of the selected point, because having the index I can get the position. Do you know if you have a way to find out what the index of the selected point is? Thank you!
There is no way through the regular Spline/SpriteShape tool, but if you switch the Inspector to Debug mode you would be able to see the list of Control points in the Spline and manually determine which points are which through their position and other details
More often when creating a SpriteShape through code, a user would create points on multiple indices and then set those positions instead. Is there a certain goal you are trying to achieve doing it your way?