Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[FREE] Shapes2D - Procedural 2D shapes for Sprites and UI

Discussion in 'Assets and Asset Store' started by all_iver, May 21, 2016.

  1. all_iver

    all_iver

    Joined:
    Nov 11, 2013
    Posts:
    158
    I haven't worked with anything other than the built-in pipeline, but I just did a quick test with URP/2D Renderer and didn't notice any issues. Unfortunately that's all I could say about it though! The best thing would be for you to try it out in your configuration and see if it works.
     
    BTStone likes this.
  2. capu087

    capu087

    Joined:
    Jan 17, 2016
    Posts:
    11
    Thanks a lot for your help! You might be correct but I'm not able to solve this :(
    Prefab is already opened in context:
    upload_2021-3-29_15-47-24.png
    Canvas is:
    upload_2021-3-29_15-48-7.png
     
  3. all_iver

    all_iver

    Joined:
    Nov 11, 2013
    Posts:
    158
    Okay, yeah I can see this behavior when I have a CanvasScaler or am using ScreenSpace with a render camera set. I think Unity is not actually recreating the entire canvas setup for the prefab context, and is just using a world space camera that simulates it, and that seems to be confusing Shapes2D. I'll make a GitHub issue for this but I don't know when I'll have a chance to look into it closer. As a workaround it does seem to work a bit better in some cases if you do the "edit prefab in isolation" thing, or do that in combination with making a scene and putting it in project settings for the prefab editing UI scene.
     
    capu087 likes this.
  4. kirbyderby2000

    kirbyderby2000

    Joined:
    Apr 28, 2017
    Posts:
    35
    I just want to say thank you so much for making this asset. This is amazing and you're a hero for making it free when you could have easily sold it. <3 Kudos to you.
     
    capu087 likes this.
  5. capu087

    capu087

    Joined:
    Jan 17, 2016
    Posts:
    11
    Okay tanks a lot for your response!
    It's not at all a blocking issue so don't worry too much about it.

    Also, the edit prefab in isolation trick works and gives the same result as in scene! Thanks again :p
     
    Last edited: Apr 15, 2021
    all_iver likes this.
  6. all_iver

    all_iver

    Joined:
    Nov 11, 2013
    Posts:
    158
    That's very nice of you to say, thank you! :)
     
  7. starfoxy

    starfoxy

    Joined:
    Apr 24, 2016
    Posts:
    183
    Love this asset. :) Odd question maybe...how do I install this asset from git? I tried adding the git url into the package manager in Unity but it doesn't seem to want to take it. Any ideas?
     
  8. all_iver

    all_iver

    Joined:
    Nov 11, 2013
    Posts:
    158
    Thanks @starfoxy , I'm glad you like it! Right now you just have to checkout the git repo to your drive and manually copy Assets/Shapes2D into your project. I have never looked into what it would take to make it automatically work in the newer package manager stuff.
     
  9. starfoxy

    starfoxy

    Joined:
    Apr 24, 2016
    Posts:
    183
    Thank you kindly @all_iver ! I will give it a go.

    There really isn't anything like this on the asset store. You should charge for this asset again.
     
    all_iver likes this.
  10. flippingkiwi

    flippingkiwi

    Joined:
    Jan 23, 2017
    Posts:
    7
    First of all, I love the asset - thanks for sharing it for free.

    I had the same issue as @IcarusCell... if I click "Edit Shape" or "Edit Path", no nodes show to be dragged or moved. I tried loading the asset into several different projects, and I even tried the version of the code from your git that is a complete project, thinking it may have been some setting of mine.

    So, I went code-diving... and it appears that, when clicking on "Edit Shape" button in the Unity Editor does indeed set the bool value 'isEditing' to true in ShapeEditor.cs, and when you click the button again it does correctly set 'isEditing' to false. So good so far.

    In the method responsible for triggering the display of the nodes though, 'OnSceneGUI', it returns out of the method right at the beginning, on the third line, because 'isEditing' is always evaluated as false.

    If I make 'isEditing' a static boolean, and click the "Edit Shape" button, it suddenly works and passes the check in OnSceneGUI... the nodes then show and I can edit the shape the way I'm supposed to.

    The problem appears to be that there are somehow two different instances of the ShapeEditor. I don't know enough about the editor to determine why there may be two instances.

    I'm using Unity 2019.4.22
     
    all_iver likes this.
  11. all_iver

    all_iver

    Joined:
    Nov 11, 2013
    Posts:
    158
    Hmm, is it possible you have two inspector panes open? I just tried that and only one of them works.
     
  12. flippingkiwi

    flippingkiwi

    Joined:
    Jan 23, 2017
    Posts:
    7
    Yes, I have three screens and generally keep two inspector windows open - one 'main' one for general use, and another for when I need to compare inspector values between different objects.

    So, I've given your suggestion a bit of a play around. If I change my Unity layout back to "standard" it works just fine. If I go back to my own custom layout and then close the second inspector (and close Unity down and re-load the project) it also works fine. As soon as I add a second inspector, clicking the "Edit Shape" button seems to only works when I click it on the second inspector window - not the original one.

    This persists even after closing Unity and re-loading the project... it only works on the second inspector window.

    Anyway, I hope this was helpful. :) And thanks again for the asset.
     
    Last edited: Dec 6, 2021
  13. BradyIrv

    BradyIrv

    Joined:
    Jan 16, 2018
    Posts:
    12
    How could I access the class Shape from runtime through another script so that I can modify the shape and then save it to a sprite? Is it possible to create a sprite at runtime and then save it to a PNG image for later use?

    It might actually be an issue with my C# Project that is denying script access to the Shapes2D namespace. Does your asset have an Assembly Definition or DLL file?
     
    Last edited: Jul 26, 2022
  14. all_iver

    all_iver

    Joined:
    Nov 11, 2013
    Posts:
    158
    The save-to-sprite feature is an editor-only thing unfortunately. You can't do it at runtime, but if you need to do that you could maybe crib from the existing code to do something similar. It just points a camera at the sprite and renders it to a RenderTexture, then saves to PNG. The tricky part is just in prepping the positions and sizes and stuff. To get at the shape stuff that is available at runtime (like modifying shape settings) you should just need a `using Shapes2D;` statement, there's no assembly or DLL.
     
  15. bakira

    bakira

    Joined:
    Jul 1, 2016
    Posts:
    19
    Hi. This asset is really awesome!
    I have a question regarding 'conversation to sprite' function.

    When there is a SpriteMask Component in a child object of a shape object, the SpriteMask is well applied to the sprite object. However, it does not apply when saving as a png file.
    Is there a way to make the SpriteMask applied even when saving as a png file?
    If possible, it would be nice if multiple SpriteMasks were applied.

    Thanks you
     
  16. all_iver

    all_iver

    Joined:
    Nov 11, 2013
    Posts:
    158
    Thank you! Yes you're right, a SpriteMask on a child does not affect a parent shape when converting to sprite. I did a very quick update to try and fix this in a "sprite_mask_on_child" branch on github. I barely tested this because I don't have time, but feel free to give this branch a try and see if it works for you: https://github.com/all-iver/shapes2d/tree/sprite_mask_on_child Sorry I don't have more time to help!
     
  17. bakira

    bakira

    Joined:
    Jul 1, 2016
    Posts:
    19
    Thank you for your quick help~

    I tested some cases using sprite_mask_on_child branch codes.
    But, it doesn't work.
    Are there any restrictions?
     
  18. all_iver

    all_iver

    Joined:
    Nov 11, 2013
    Posts:
    158
    Not that I can think of but I may have just botched it...can you give me a step-by-step of a simple test that doesn't work? I just did a quick test with a parent shape and a child shape, and had SpriteMask components on one/both to see if convert to sprite worked.
     
  19. bakira

    bakira

    Joined:
    Jul 1, 2016
    Posts:
    19
    1.
    - Parent
    . Shape (donut)
    . SpriteRenderer (mask interaction : not visible under mask)
    - Child
    . SpriteMask (set sprite)

    2. I could see a donut with the mask sprite part hidden.

    3. Create png file by click 'conversion to sprite' button

    4. Mask was not applied to png (just donut)
     
  20. all_iver

    all_iver

    Joined:
    Nov 11, 2013
    Posts:
    158
    Oh I see, try adding a Shape component to the child... But you can disable the SpriteRenderer component on the child so it isn't visible. That way works when I try it.
     
  21. bakira

    bakira

    Joined:
    Jul 1, 2016
    Posts:
    19
    I test some cases according to your guide and it works fine
    Thank you for your kindness
     
  22. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    1,047
    Hi, I just started using your asset with Figma for Unity asset on URP. I don't think the shader is compatible with URP as the fill color is not being set correctly.I opened a github issue - https://github.com/all-iver/shapes2d/issues/26