Giter VIP home page Giter VIP logo

shapes2d's People

Contributors

all-iver avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

shapes2d's Issues

bugs when rendering shapes on Screen Space Canvas (HDRP)

when i place shapes on screen space canvas, it looks wrong.
image
shapes have kind of transparency, but alpha of colors is 100, and when i changing alpha in Canvas Group, shapes starting look very strange

all this bug s disappering when i convert shapes to png
image
image

Prefab icon renders incorrectly

Report from a user:

Found a bug in shapes2D. using unity 2019.3.3f1. I created an empty object, applied a shape2D of a 1x1 rectangle. Then drug it to the project to create a prefab. Now when I click the prefab in the explorer the explorer icon (as well as the icon in the inspector constantly switches between a pink square and the unity prefab icon. when it's switching it makes the inspector unresponsive. I found a work-around, by disabling and re-enabling the sprite renderer on the prefer it fixes it, maybe even permanently. Another note: I am using the new 2D experimental render pipeline, i don't know if that has anything to do with it though.

Also:

After I disable and enable the sprite renderer it stops blinking back and forth between the icon and the sprite image. You're correct that the sprite image never correctly shows the sprite. It's always pink, but this is fine, it's the switching between the image and the icon that is causing issues. I've creating another work around, as it only seems to happen where the prefab has your components attached to the root object. So I just created an empty object and nested my shape. Now it doesn't do it anymore.

Fill color not set corectly with URP

Hi Using Unity 2021.3.19 or 2022.3.1 when URP is used, the fill color is not set correctly.
For my test I used a fill color of 131120. This should be almost black but it comes out as 4F4B65 when sampled with the color dropper

Documentation is down

I just downloaded from the Unity store, but the Documentation is down so I can't use it.

Shapes don't observe SpriteMask

I haven't looked into this yet, just noting here for future reference that it doesn't work...however UI Shapes do work with Mask/RectMask2D.

Incorrect scale of outlines and roundness, etc, when editing prefab in some cases

When editing a UI prefab in the scene, if you have a CanvasScaler or are using a ScreenSpace canvas with a Render Camera set, the shape's scale seems to be wrong in the prefab editing view. Using edit in isolation seems to do a bit better, and then you can provide a scene for Unity to use, but it's not a perfect solution. I believe Unity is using a world space canvas for prefab editing instead of using the canvas from the scene.

Allow setting bake-to-PNG resolution for UI shapes (currently only works for sprite shapes)

Easy fix is:

in Shapes2D/Scripts/Shapes.cs, change the lines at 1514,1515 from this:

    w = Mathf.Max(1, Mathf.RoundToInt(bounds.size.x / scaleFactor));
    h = Mathf.Max(1, Mathf.RoundToInt(bounds.size.y / scaleFactor));

to:

    w = Mathf.Max(1, Mathf.RoundToInt(bounds.size.x / scaleFactor * pixelsPerUnit / 100));
    h = Mathf.Max(1, Mathf.RoundToInt(bounds.size.y / scaleFactor * pixelsPerUnit / 100));

Then you can use the "Pixels Per Unit" setting in Shapes2D/Preferences, so for instance if you set it to 400 then your 64x64 Shape gets turned into a 256x256 PNG which should look nicer. You can also play around with the mipmap settings for the imported PNG, that might make a difference in how it ends up looking in-game.

Really, it might be nice to be able to set the PNG resolution you want each time you bake to sprite.

Add Shape to Image -> Invisible

First, thanks a ton for this project!

I have a small issue where when I add the shape component to an image, the image becomes invisible until I run the game. Once I do so, after stopping the game, the image remains visible.

I believe it could be due to material generation, maybe at runtime it gets called again?

Possible issues with Samsung Galaxy S9/S10

Got a report of some shapes rendering wrong on S9/S10 (these devices have multiple possible hardware configurations and I couldn't replicate using device farm). They are using a radial gradient with a lot of blur. Possible workaround is to change the radial gradient code in the shader slightly and not use any blur. Not sure what the actual cause is though.

Option to fit-inside-rect when creating a shape from a PolygonCollider2D

This would help in cases where you have a PolygonCollider2D with points that don't fit inside a 1x1 rect. Some example code below that would do this for a poly shape (not done for paths)...replace the appropriate parts of ShapeEditor.FromPolygonCollider2D(). However, this means the shape doesn't fit to the collider - the fix would be to then click "Set Polygon Collider 2D" to re-create the collider inside the shape's bounds. If we do this, we'd want to make it optional somehow.

            PolygonCollider2D pc2d = shape.GetComponent<PolygonCollider2D>();
            if (shape.settings.shapeType == ShapeType.Polygon) {
                if (pc2d.points.Length >= 64) {
                    EditorUtility.DisplayDialog("Too many points", 
                            "The PolygonCollider2D has too many points (max 64).", "Okay");
                    return;
                }
                // get the polygon collider's bounds
                var bounds = new Rect(pc2d.points[0].x, pc2d.points[0].y, 0, 0);
                for (int i = 0; i < pc2d.points.Length; i++) {
                    var p = pc2d.points[i];
                    bounds.xMin = Mathf.Min(bounds.xMin, p.x);
                    bounds.xMax = Mathf.Max(bounds.xMax, p.x);
                    bounds.yMin = Mathf.Min(bounds.yMin, p.y);
                    bounds.yMax = Mathf.Max(bounds.yMax, p.y);
                }
                var scale = 1 / Mathf.Max(bounds.width, bounds.height);
                // transform to shape space, re-centering and scaling so that the major dimension fits just inside
                Vector3[] points = new Vector3[pc2d.points.Length];
                for (int i = 0; i < pc2d.points.Length; i++) {
                    var p = (pc2d.points[i] - bounds.center) * scale;
                    points[i] = shape.transform.TransformPoint(p);
                }
                Undo.RecordObject(shape, "Edit Shapes2D Polygon Vertices");
                shape.SetPolygonWorldVertices(points);
                EditorUtility.SetDirty(target);
            } else if (shape.settings.shapeType == ShapeType.Path) {

Polygon shape doesn't work on iPad?

User reports that polygon shapes are just black boxes on iPad. Possible shader compilation error but unable to figure it out. Other shape types including path worked fine.

Gradient Changes

Some feature Suggestions if possible

  1. Outline Gradient
  2. Corner based Gradient option if possible. (Like I want to add multiple gradients in single sprite)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.