Tell us about your experience with Sprite Shape

Hi,

Is there any way to randomize the sprite variants directly between the points instead of selecting only one sprite variant for one point?
The only thing i could think of is making a lot of points and manually set different variants for each point to get a good random design but it’s heavily time consuming and resulting in a point overdose.:frowning:

Hey there! Trying to use sprite shapes for super fast, yet still accurate prototyping, and so it would be nice to be able to snap to the grid by holding ctrl/cmd (or at least enable snapping through a shortcut).

In the same vein, it seems like snapping gets disabled often when moving the shape around with transform tools. Conversely, when moving control points without moving the whole shape with transform tools, the pivot ends up far away from the actual shape.

Could be user error on all accounts, but these are just some thoughts :slight_smile:

2 Likes

Sprite Shape Renderer does not take its shape into account when rendering normal buffer for 2DLighting.

Also, probably related to the same issue, where if you scale the sprite negatively, that too… is not taken into account when rendering normal map buffer.

Rotating the actual sprite does seems to work however.

Thanks, but I think this should really be implemented to SpriteShapeController level, so we can just call it.

Hi, I am adding PolygonCollider2D to the sprite shape at runtime. The issue is, it does not gets updated on the same frame… is there a function to update on the same frame? BakeCollider or setting autoUpdateCollider before adding doesn’t work

Having a fundamental issue with sprite-shape, and wanted to see if there was maybe a work-around?

2D lighting doesn’t seem to effect the FILL texture at all, everything else it does fine with. Not exactly sure why this is, but I hope there’s a way around it, otherwise I’ll need to find an alternative to spriteShape.

Here’s a screenshot of my inspector, and a comparison of the same texture on a sprite shape and on a regular sprite.

2 Likes

Yeah, 2D Lighting does not seem to work nicely with SpriteShape at all at the moment. We need official respond from Unity to clarify this.

1 Like

SpriteShape Renderer is indeed supported by 2D URP. We will take a look asap. @jarbleswestlington_unity Could you kindly please submit a bug with this simple repro project that could help us validate this ?

1 Like

Since the entire generation happens in a Job, Collider gets updated in the next frame.
However if you would like to force generation in the same frame, please make sure to call these functions in this order:
spriteShapeController.BakeMesh();
spriteShapeController.BakeCollider();

1 Like

@Venkify , while you are at it, please check this as well :

My issue is to do with above and normal map buffer not being rendererd properly. (Not taking negative sprite scale + shape itself)

We have added a new API to set custom Bounds in 2021.2 to support fixing the above.
https://docs.unity3d.com/2021.2/Documentation/ScriptReference/U2D.SpriteShapeRenderer.SetLocalAABB.html
We are fixing the above issue in an upcoming package release. Until then, please use the Render Mesh workaround or set custom Bounds to reflect any changes made to SpriteShape object on Runtime.

Thank you, it worked perfectly!

This thread was started to get feedback, not to serve as a magnet for asking how to use the feature.

Please start you own threads rather than resurrecting/hijacking old threads; they’re free to do! :slight_smile:

1 Like

Using Sprite Shape 7.0.3 alpha is not applied on the sprite shape. Is this intended?

I’m experiencing something with sprite shapes that I can’t seem to find anyone else talking about and this one’s a head scratcher.

TLDR I’m trying to make an asteroids clone for practice. I’m using sprite shapes for the asteroid prefab and then moving the spline control points around on instantiation to give them all a randomized appearance. so far so good. however as the game progresses and I am instantiating more and more of these prefabs, frequently the game object is instantiated with all of its components disabled for apparently no reason and with no error thrown in the console. if I pause the game, and then manually check the boxes to turn the components back on, then unpause magically the prefabs manifest into existence and work like normal. seems to happen more frequently if I’m creating a lot of them at a time in the same frame.

I’m going to have to assume this is a bug or it’s by design but not throwing any warnings or errors (Is it a conflict with trying to create too many things in nearly the same place?)

side note: I would like to second the notion that the sprite sheet used for the textures could use the traditional nine tile orientation where the bottoms and sides face downwards and sideways respectively, rather than having to be oriented facing upwards

Here’s a vid of it occurring:
https://www.youtube.com/watch?v=pDdKFc7fJyo

And I attached an image of the Inspector when this happens.

Edit: I tried spawning them on different frames, and it still happens. :eyes:

7880287--1002352--Screenshot 2022-02-08 125731.png

Please, see my post above. Please create your own thread and/or report a bug if you believe it is one.

Thanks.

Hi, there is no reason why the Components are auto-disabled. Could you please post a repro/sample project or file a bug report with the project ? Will take a look asap.
Also as mentioned by @MelvMay , kindly start a new thread for the case if possible as its easier to follow and respond. Thanks.

heey, how do I get the Sprite Variant of a point specified by the code? I am replicating the behavior of editing the Sprite Shape at runtime and need to display the available sprite variants for the specific point I select.

Use SetSpriteIndex to set variant for a specific control-point.
Note, there are a few conditions such as the Tangent mode at the point etc for the variant to be actually set.