2D Sprite Shape 6.0 released for Unity 2021.1

2D Sprite Shape 6.0 released for Unity 2021.1

What’s new?
With the release of Unity 2021.1 2D Sprite Shape 6.0 is now available. In this release:

  • The Sprite Shape edge height is now interpolated linearly between control points that are both linear and smoothly if otherwise.
  • See the full changelog here.

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:

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:

What can you do?
Try it out and let us know what you think of the package. We want to know what works as expected, what doesn’t and what is missing.

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.

7135400--853022--Capture d’écran_2021-05-13_00-04-31.jpg

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.

6 Likes

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! :slight_smile:

will the API get a page on SpriteShapeController?

https://docs.unity3d.com/2021.2/Documentation/ScriptReference/U2D.SpriteShapeController.html

The packages have their own documentation: https://docs.unity3d.com/Packages/com.unity.2d.spriteshape@6.0/manual/SSController.html

1 Like

sure, thats not the API docs though… something like this: Unity - Scripting API: SpriteShapeRenderer

https://docs.unity3d.com/Packages/com.unity.2d.spriteshape@6.0/api/UnityEngine.U2D.SpriteShapeController.html

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.

1 Like

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. :slight_smile:

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:

  • open the package manager,
  • go to the package you need to learn about,
  • click on the documentation link on the right.

7181938--861247--Capture d’écran_2021-05-27_16-44-04.jpg
:slight_smile:

1 Like

Normal map rendering is broken with 2drenderer using spriteshape.

Normal map is broken in URP 11 anyway. :slight_smile: Works in URP 12.

Right… where did you get that information?

From my personal experience, and: https://discussions.unity.com/t/827572/17

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.

2 Likes

Are there chances that SpriteShapes will use Secondary Textures someday? Custom materials?

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?

Is it possible to upgrade to Unity 2021.1 without upgrading to SpriteShape 6.0.0?

If you call BakeMesh();

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)

Any Idea?

Reposting from ( https://discussions.unity.com/t/847356 ) for visibility.

SpriteShape generator runs in a Job. If BakeMesh is called, please make sure to complete this Job before destroying the Object or Unload the scene.

var jobHandle = spriteShapeController.BakeMesh();
// You can also call BakeCollider to update Collider here.
jobHandle.Complete();

Otherwise the Job might be running in parallel while the GameObject is being destroyed, hence the error message. Thanks.