SpriteShape Preview Package

I can’t believe I missed that the sprites are place on the spline based on their pivot haha

Hi Venkify,

I was just wondering if you saw my post regarding the inability to reference the SpriteShapeController. I have the correct Manifest.JSON and using headers.

Please use UnityEngine.U2D namespace for SpriteShapeController. You may also want to refer to the sample script above.

Thanks for submitting. We have verified that it has been fixed.

Okay, thank you

Yes, that’s very much what I meant. What I thought of in terms of implementation was having a Spline Component in the main GameObject, the children each having one of the SpriteMeshes. In the parent object I would put my MetaSpriteMesh thing, which would reference a base Spline (in this case the one in the same object) as well as a list of tuples of all affected SpriteMeshes and their individual Vector3 (or even full-on Transform) offsets. Using the imported sprite’s pivot to avoid the need of manual offset is cool though, haven’t though of that. For some cases it surely would be handy.

Thanks! I’ll surely be following the development of the tool.

Is this going to be available to use in unity 2018.1?

1 Like

same question

1 Like

same

It’s available right now to use with the public 2018.1 beta so it’s almost definitely going to be available to use in the full release of Unity 2018.1.

Whether it’s going to lose its “experimental” tag before the full release of Unity 2018.1 is unknown but I would lean towards assuming not. But it’s available now for testing so if you want to use it, you can.

How do I set spline detail from the code? This is what I currently have

 //Add the sprite shape components needed to make the generation
        SpriteShapeRenderer ssR = newTree.AddComponent<SpriteShapeRenderer>();
        SpriteShapeController ssC = newTree.AddComponent<SpriteShapeController>();

        //Make a reference to the spline
        Spline mySpline = ssC.spline;

        //TODO : Set the spline detail so it can render stuff
       ------- stuck here ----

        for (int i = 0; I < points.Count-1; i++){

            //Set up our spline points
            mySpline.InsertPointAt(i, points[i] );
}

Do you mean m_SplineDetail member in SpriteShapeController ?

1 Like

My first thought: This feature demands native support for Vectors/Splines/.svg ! :smile:

I just returned from some years Unity absence and this is a nice surprise. Exactly what we need.
So far no bugs for me.

Transparency in fill & border produces visible overlay problems (obviously), when the fill has +Offset. 0 Offset on Fill + Bottom Pivot on the Border on the other hand leads sometimes to little gaps. But I guess this can be minimized with carefull sprite planning. I just pushed the Endless/Purple assets around and it seems to be more glitchy the thicker the border is.

3452497--273582--shape_gap.PNG 3452497--273583--shape_opac.PNG

Sorry for the plethora of issues,

but “ArgumentException: shapeParams.splineDetail (0) must be within 4 - 32.” comes up, and I cannot figure out how to use the struct.

A minor usability request:

When editing a Sprite Shape Controller, the Sprite Index Slider goes from 0 to 63, regardless of how many Sprites are defined in the Sprite Shape list. Would be nice if that slider would max to the actual number of items in that list. (But this probably may be not so trivial to implement, since every range can have a different number of sprites in it’s list…)

Related: Also nice to have would be a “Random Sprite Index” checkbox in the controller. This is probably easy to script, I did’nt try it yet. But, of course, it would be cooler to have this without additional user code.

1 Like

splineDetail basically defines subdivision level of the base spline. Acceptable values are between 4 and 32. If you are trying to do procedural generation, I would suggest the regular workflow of using SpriteShape Asset and SpriteShapeController component which makes the setup part easier. You can always alter/add/delete control points on the runtime to procedurally generate spriteshapes. It would be great if you provide more info on what you would like to do. That would be really helpful to us to respond better and improve the feature as required. Also please feel free to post your questions/feedbacks.

Thanks for the feedback. Good suggestion (a bit tricky given each range can have different number of sprites). Will try to look adding this.

Yes, as you had mentioned it could be done through a custom script. Also we will add more custom scripts to the Github samples project based on feedback received in the forum in the coming week. Please keep the feedback coming.

Okay! I am currently trying to spawn a SpriteShape along a user’s mouse input to create, say, a tree

Attached is a simple script to do this. This could be done by just modifying the Spline on the run-time.

3455366--273908--spriteshape3.gif
3455366–273909–Draw.cs (1019 Bytes)

2 Likes

I will try this a little later but first I have a number of questions:

  • Does this support holes in the sprites? This is something I implemented in our internal version of Ferr2D by introducing the concept of subterrains. The subterrains were individual Ferr2D components, allowing full edge editing etc. but they were bound by the parent terrain and would be fed into the parent’s triangulator with reverse winding. Very useful for complex layered terrains.
  • Does it support local overriding of the edge graphic at a control point, ignoring the angle?
  • Most importantly, does it come with source?

Yes, this can be overridden per control-point. (Just add multiple sprites for the Angle-Ranges and set the SpriteIndex for the corresponding point).

Most of the source is available in the package except the geometry generator which is part of Engine written mostly in native SIMD for high performance.

Could you please provide more info ? Perhaps screenshots or sample scenes should be helpful.

Thank you for your help! I appreciate the support you’ve been giving to us