SpriteShape Preview Package

3431073--271057--SpriteShapePreview.gif
We’re happy to share that SpriteShape is now available for preview. SpriteShape is a sprite layout or world building tool that provides the ability to tile sprites along the path of a shape based on given angle ranges. Additionally the shape can be filled with a tiling texture.

The main feature of the SpriteShape is the powerful combination of a bezier spline path with the ability to tile Sprites adaptively or continuously while automatically switching Sprites assigned to given angles.

Getting Started:

Take a look at the manuals and try out the samples. We’d like to know what you think, so please reply to this post or create a new one to tell us about your experience with this feature.

Tell us how this fits into your workflow or enhances your project? What worked smoothly? And what didn’t?

We’re eagerly waiting to hear back from you!

28 Likes

I have been waiting for this for a long time, glad its finally here. I have been using it for a few hours now and have some feedback and questions.

  1. The RGBA values are linked to the wrong channels from the inspector. The R is adjusting the A, the G is adjusting the B, and vice versa.
  2. When I set sprite to medium or low, the corresponding medium / low collider doesn’t match it.
  3. You should be able to manually overide selected angles.

I am using latest Git release of the plugin as 18:00 GMT - 21.3.2018, and Unity 2018.1b11.

Thanks for the feedback. This has already been fixed and will be available in next beta (2018.1 b12).

Collision and Rendering mesh are generated using different tessellation algorithms. Hence there maybe slight differences in generated geometry at low/medium levels. Please file a bug if required.

To modify angles, you could edit them directly in Inspector for each Angle Range.
You can also specify multiple sprites for an angle-range. You may then modify SpriteIndex property to select a specific sprite for control-point

Looks great! Any chances of extending the bezier spline deformation so it could be used for animating/deforming 2d characters aswell?

Rayman legends uses a bezier patch deformation technique for their character animation/rigs. You get that nice deformation instantly for free without the need to manually paint skin weights in a 3d software:

4 Likes

I am getting a crash when I roll a ball (circle collider) over a SpriteShape. I have included a screepcap below to show exactly what the SpriteShape collider looks like.

When rolling the ball along there, sometimes it crashes in seconds, sometimes it takes 5 minutes, but it will always crash. Built to Windows.

The Output Stack:

0x000002549E3F85AC (Mono JIT Code) (wrapper managed-to-native) UnityEngine.Collision2D:FreeContacts (intptr)
0x000002549E3F84E0 (Mono JIT Code) UnityEngine.Collision2D:Finalize ()
0x000002549E30A649 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_virtual_void__this__ (object,intptr,intptr,intptr)
0x00007FFA54F78535 (mono) mono_gc_is_finalizer_thread
0x00007FFA5509CF66 (mono) mono_unity_class_get
0x00007FFA54F78865 (mono) mono_gc_is_finalizer_thread
0x00007FFA54FE40C3 (mono) mono_thread_interruption_request_flag
0x00007FFA5509A05F (mono) mono_unity_class_get
0x00007FFA7B4D1FE4 (KERNEL32) BaseThreadInitThunk
0x00007FFA7DF1EF91 (ntdll) RtlUserThreadStart

No files generated in the crash folder.
There are no errors in the editer, I tried performing the same actions in the same place, no problems at all.

Unity 2018.1b12

Looks like it could be related to recent Physics2D changes. We will take a look. Please file a FogBugz with a simple reproducible scene if possible.

When I click on Edit Spline no control points show up, and also the option to change the point mode is grayed out. Any suggestions?

edit: I found a solution. Resetting my workspace to Default fixed the problem for some reason.

1 Like

thankyou, been waiting for this a long long time :slight_smile:

2 Likes

I’m not sure how to explain this, but I noticed that if I create a new sprite shape profile and add a sprite on top but not on bottom, any created shape will disappear when the camera moves down

Also, I honestly think the offset slide should be for the sprites not the fill texture.
Sometimes the user may want the collider to go over the sprites he set up. Specially for ground surfaces and the collider offset will just not be efficient if your shape isn’t a flat surface

Here are some screenshots:

Other than that, great job! Been waiting for this for a while now!


1 Like

I think there could be a bug with BoundingBox generation. Could you please submit a bug with a sample scene/project ? We will try to fix at the earliest.

We will take a look at this. Thanks for the feedback.

Hello!

I am playing around with SpriteShape, but was wondering how I could go about accessing/modifying different points on the Spline via script? I tried looking at the Scripting API, but my tinkering so far has led to no results. I would appreciate any tips that could point me in the right direction!

1 Like

3 questions:

  • Is the spline editor used in this tool available as a separate component / is it possible to create my own without having to actually reeimplement in some major way? I’d love to use it as a general tool. It could even be used to implement “meta-friezes”, as UbiArt calls them (which are basically multiple friezes (smartsprites) driven by a single spline).
  • Is there a keyboard shortcut/global setting to toggle Edit Spline? First thing I noticed was how much it bothers me to have to click my way out of the scene view to enable it.
  • Is it possible to move multiple selected points at once? I feel like I’ve already done it, but now it doesn’t seem to work and I’m thinking it might be a bug. Edges between selected points are not highlighting either, if they’ve ever done that.

Also, some suggestions on improving the workflow

  • Shift+clicking to a add new point on cursor position. Ferr2D does it and it seems to make quite a lot of sense, although I have not used it yet. That is to say, I know it is possible and not being able to do it makes me uncomfortable.
  • Shortcuts to change point modes (if possible, one that pops up a context menu in cursor position with all point related settings)
  • Esc my way out of Edit Spline to allow selection of another object. The only way I’ve found how to do this currently is switching tools, which is not really that bad, but because I like the Rect Tool better to work in 2D I find it quite annoying to use since it is bound to T. I’d very much like it better if I could just Esc back to my last selected tool.

I’ll probably come up with some more questions / suggestions as I test it, but so far, I like very much what I’ve seen. Please, keep it up!

You can access the controlpoints data through SpriteShapeController’s spline member. A simple sample to animate points below :

void Update ()
{
var spriteShapeController = GetComponent<SpriteShapeController>();
var spline = spriteShapeController.spline;
for (int i = 0; i < spline.GetPointCount(); ++i)
{
Vector3 pos = spline.GetPosition(i);
pos.x = pos.x + (Random.Range(-0.01f, 0.01f));
pos.y = pos.y + (Random.Range(-0.01f, 0.01f));
spline.SetPosition(i, pos);
}
}

Also the source of SpriteShape package is usually located here :
C:\ProgramData\Unity\cache\packages\staging-packages.unity.com\com.unity.2d.spriteshape@1.0.9-experimental

1 Like

Thank you so much! Can’t wait to play around with it!

So I can’t seem to find SpriteShapeController - it says it is missing an assembly file or something.

This is my manifest.json

{
  "dependencies": {
  "com.unity.2d.common":"1.0.8-experimental",
  "com.unity.2d.spriteshape":"1.0.9-experimental"
  },
  "registry": "https://staging-packages.unity.com"
}

And in my C# script I am

using Unity.Experimental.U2D //whatever it's called
1 Like

Yes, it is possible. Also each Angle Range can take upto 8 sprites and its possible to toggle between these sprites at a control point. See the gif attached.

Will take a look. Also shortcut key for Toggle Point Mode is ‘M’ and to toggle Sprite Index is ‘N’

Please select all the points and use Shift+Drag.

Thanks for the feedback.

As stated above, please use Shortcut key M.

Will take a look and see how this changes workflow.3441464--272334--spriteshape1.gif

I believe we have found the bug and fixed it. Could you please post a bug with a reproducible scene/project which would help us verify ?

Good news!
Just submitted it
ID: 1019411

Yes, I know about those. What I meant about the meta-friezes thing was something like this:

https://www.youtube.com/watch?v=WFu1utKAZ18

Multiple SpriteShape equivalents being driven by the same curve.

Oh. Funny, I though I’d tried bashing through the entire keyboard. Well, I was very sleepy by that time. Thanks!

Wow, that sounds very counter-intuitive for me. Is there a UX/Technical reason as to why it’s necessary to hold Shift while doing it instead of just having the points selected and dragging one?

Thanks for the attention!
Also, I’m sorry if I’ve been sounding too bratty about this. It’s just that this is a tool of major importance for me, so I’m very much worried about it being consolidated in a less than perfect manner. It’s already very good, but it could easily be better and I’m sure other people might have some nice ideas about it as well.

1 Like

Ah, I see. Thanks for the suggestion. We will investigate adding this in a native way. However you can already add such functionality using custom scripting that mirrors the Spline for the second object. Please find a sample script just for demonstration attached.

Video for the same:
https://www.youtube.com/watch?v=ZAU0u2JwG84

We are definitely looking for ways to improve and add features that makes using SpriteShape easier. Please feel free to post your suggestions/ideas/comments :slight_smile:

3442836–272475–MirrorSpline.cs (1.22 KB)

1 Like