About Sprite Shape
Sprite Shape is a flexible and powerful world building Asset that features Sprite tiling along a shape’s outline that automatically deforms and swaps Sprites based on the angle of the outline. Additionally, you can assign a Fill texture to a Sprite Shape to create filled shapes with tiled textures as backgrounds or other large level-building props. Read more in the Sprite Shape documentation here.
Getting Started
In an existing project in Unity 2021.1:
Open Package Manager by going to Window > Package Manager
Select Unity Registry in the Packages drop-down menu.
Choose 2D Sprite Shape from the list and click on Install at the bottom right of the Package Manager window.
Creating a new project in Unity 2021.1 by selecting the 2D Template in Unity Hub will also install 2D Sprite Shape 6.0 by default.
Explore the Samples
2D Sprite Shape comes with Samples showing the features in action and Extras scripts that show how to extend the functionality of Sprite Shape.
To get the samples:
Open Package Manager by going to Window > Package Manager
Select Unity Registry in the Packages drop-down menu.
Expand the Samples section.
Click the Import button next to the sample you want to import.
Yeah, I must be particularly dumb because I cannot even reproduce the more basic of the samples… Either the outline is entirely orange, or the green one is down on the right instead of on the top.
Okay, after toying a bit with your sample, I understand that the outline colour is linked to the points, move the points and the outline colour will move with it.
Yeah, the SpriteShape can only change which texture it uses when it passes a non-continuous node. Otherwise it keeps using the angle value of the first counter-clockwise node that’s not continuous.
This behavior is not documented as far as I can tell, and I have no idea why they did that. Maybe @rustum has some insight?
There’s also a bunch of other stuff that’s just not written down in the docs. There’s a lot of things you have to know about how to build the textures and how to set the sprite borders on import in order for things to not look like a disaster that you just have to figure out by testing and by working backwards from the samples.
So while the SpriteShape can give you great results, nobody bothered to sit down and write how to get those great results from the tool.
Yeah, I have given up on that for now. I had in mind that I could animate sprites using that tool but it seems that 2D Animation will do that very well after all. And it’s easy to use too!
But yeah the package docs UI (not just for SpriteShape, just in general) isn’t working at all since people on the regular just can’t find anything there.
I cannot agree with that; I cannot speak for all the packages either but I’ve learnt how to use some of them reading their documentation. The SpriteShape one is lacking, true, but you cannot judge all the others by this one.
Also, I’m not sure you can find this specific documentation using a search engine, people need to get the right reflex: if you need to learn about a package:
Is there any way to merge SpriteShapes? Or even just make it look as if they are merged?
I’m trying to use SpriteShapes to build rooms that close in on themselves, so there are quite a couple of points where my shapes overlap themselves or other shapes and I would like those to blend into each other to create a closed loop. (I’ve attached an image to better explain what I mean.)
Now I know that SpriteShapes, as they are now, are more intended for platformers and the like, but I feel like even platformers could greatly benefit from such a feature.
Is this a planned feature, or are there already ways of solving this problem?
I think one way to fix this would be to allow users to manually set which sprite a segment should use. We can already disable corners, so I think being able to change the line sprite would be nice too.
SpriteShape does seems like it is rendering normal map, but it is not rendering it properly. It does not take shape tangent into account, which makes it look wrong. Not really usable with normal map right now. At least with 2drenderer.
Since I updated SpriteShape to 6.0.1, the edge colliders on my platforms now end where the spline ends instead of where the sprite ends. Is this part a new feature? Any ideas on how to fix it? Is this happening to anyone else?
and then have scene unloaded so the SpriteShapeController is destroyed I get :
InvalidOperationException: The previously scheduled job SpriteShapeGenerator writes to the Unity.Collections.NativeArray1[Unity.Mathematics.float2] SpriteShapeGenerator.m_ColliderPoints. You must call JobHandle.Complete() on the job SpriteShapeGenerator, before you can deallocate the Unity.Collections.NativeArray1[Unity.Mathematics.float2] safely.
Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle.CheckDeallocateAndThrow (Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle handle) (at :0)
Unity.Collections.LowLevel.Unsafe.DisposeSentinel.Dispose (Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle& safety, Unity.Collections.LowLevel.Unsafe.DisposeSentinel& sentinel) (at :0)
Unity.Collections.NativeArray`1[T].Dispose () (at :0)
UnityEngine.U2D.SpriteShapeController.DisposeInternal () (at Library/PackageCache/com.unity.2d.spriteshape@6.0.1/Runtime/SpriteShapeController.cs:247)
UnityEngine.U2D.SpriteShapeController.OnDisable () (at Library/PackageCache/com.unity.2d.spriteshape@6.0.1/Runtime/SpriteShapeController.cs:267)