Search Unity

  1. Calling all beginners! Join the FPS Beginners Mods Challenge until December 13.
    Dismiss Notice
  2. It's Cyber Week at the Asset Store!
    Dismiss Notice

SVG Importer | Vector Graphics | Unity UI Supported [OPEN SOURCE]

Discussion in 'Assets and Asset Store' started by Jaroslav-Stehlik, May 4, 2015.

  1. lattejed

    lattejed

    Joined:
    Jul 14, 2016
    Posts:
    3
    Hey, thanks for the input. Yeah, they seem to be stripping leading 0s *and* whitespace, which I'm guessing is just a bug that either made it though their test suite or was never tested properly. I've tried to open them in other programs and they're straight up broken.

    So if I understand you correctly, a vanilla "Save As..." will bypass the faulty conversion method?
     
  2. lattejed

    lattejed

    Joined:
    Jul 14, 2016
    Posts:
    3
    Thanks again! That plugin does work.

    As an FYI, if anyone uses this plugin, it will only export layers named with the *.svg extension.

    @Jaroslav Stehlik You really need this info as an FYI somewhere. While this is entirely an Illustrator issue, I'm sure a lot of people are going to run into this.
     
    shaneparsons likes this.
  3. shaneparsons

    shaneparsons

    Joined:
    May 5, 2015
    Posts:
    41
    Last time I tried, the vanilla "Save As" with no minification worked just fine. You'll likely have to use this method for svgs with transparencies as well because that plugin doesn't seem to always handle them nicely.

    Whether or not we wait for adobe to fix it (unlikely to happen any time soon), or hope there's a fix from the SVG Importer side, I hope something's done about it eventually.
     
  4. shaneparsons

    shaneparsons

    Joined:
    May 5, 2015
    Posts:
    41
    While I agree it's definitely Illustrator's issue, it's hard to say if they see it as a "bug" as their main intent is for web, where the svgs have no issues. Because of this, I doubt it gets brought to their attention often enough to make it to their priority list.

    @Jaroslav Stehlik if there is any way SVG Importer could bypass their encoding issues that would be a pretty key feature to add.
     
  5. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    Everyone! I have great news. SVG Importer hits RC version.
    Whoever wants to test it just send me an email.

    Fully working gradients editor/runtime
    Fully working antialiasing/fake blur/motion blur
    Fully working mesh modifiers
    new UV Transform modifier for texture overlays.
    new examples with mesh modifiers and sources.

    have a great day!
     
    ElKrullo, jasonMcintosh, pabu and 2 others like this.
  6. fruityth1ng

    fruityth1ng

    Joined:
    Mar 27, 2015
    Posts:
    2
    FYI, Illustrator just updated with a native Export for screens feature, which includes SVG!
    This provides for separate artboards / assets and such, I believe.
     
    Jaroslav-Stehlik likes this.
  7. silentneedle

    silentneedle

    Joined:
    Mar 14, 2013
    Posts:
    280
    I'm receiving the following shader errors when building under windows:

     
  8. shaneparsons

    shaneparsons

    Joined:
    May 5, 2015
    Posts:
    41
    Yeah the feature is great, but unfortunately the svgs that it produce are "corrupted" from SVG Importer's point of view.
     
  9. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    919
    Hi there, i have started using SVG Image in a Unity UI based app/game.
    I have few questions regarding performance. I use white svgs and then tint them, so single white svg with 50 tints is good or bad? or should i use a color svg?
    Secondly in traditional UI we have Atlas to lower draw calls, what happens in SVG Case?
    Thanks
     
  10. silentneedle

    silentneedle

    Joined:
    Mar 14, 2013
    Posts:
    280
    p.s. This error only happens when building on Windows, it doesn't show up on MacOSX as it seems to be related to d3d
     
  11. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    919
    Getting following error

    This error happens when i immediately load another scene.

    NullReferenceException: (null)
    UnityEditor.SerializedObject..ctor (UnityEngine.Object[] objs) (at /Users/builduser/buildslave/unity/build/artifacts/generated/common/editor/SerializedPropertyBindings.gen.cs:74)
    UnityEditor.Editor.GetSerializedObjectInternal () (at /Users/builduser/buildslave/unity/build/artifacts/generated/common/editor/EditorBindings.gen.cs:154)
    UnityEditor.Editor.get_serializedObject () (at /Users/builduser/buildslave/unity/build/artifacts/generated/common/editor/EditorBindings.gen.cs:147)
    SVGImporter.SVGImageEditor.OnEnable () (at Assets/SVG Importer/Editor/Core/SVGImageEditor.cs:42)
     
    Last edited: Jul 27, 2016
  12. jocyf

    jocyf

    Joined:
    Jan 30, 2007
    Posts:
    252
    Uh!!!! That's good news!!!
    I'm using your asset in my game and it works great. (Waiting for the fully working gradients part... lol).
     
  13. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    919
    @Jaroslav-Stehlik
    Please add Raycast Target checkbox in SVG Image, as its interfering a UI app im working on.
     
    Jaroslav-Stehlik likes this.
  14. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    Hello, in the beta version for which you can send me an email there is this function presented.
     
  15. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    Great, you can send me an email to get the RC version.
     
  16. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    hello,
    just remove standard shader from SVG Importer
     
  17. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    hello,

    In the case of UI it is perfectly ok to use white shape and simply recolor it in Unity.
    Because we are using meshes only, atlasing is possible only when SVGs are baked into a
    texture which would introduce more memory consumption and the resolution would be finite.
     
  18. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    This looks more like and Unity Editor error. Which version of Unity and does this happen everytime and only with SVG Importer?
     
  19. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    919
    and please
    So you are saying that multiple SVG Image Components with 1 white svg (actual svg referenced by these components) with multiple color tints wont add any "extra" draw calls?
     
    Last edited: Jul 29, 2016
  20. nialltl

    nialltl

    Joined:
    Jul 30, 2016
    Posts:
    5
    Hi, just bought this plugin! Will there be any support soon for the SVG gaussian blur filter? Demonstrated in e.g. https://gist.github.com/archana-s/8947217. I'm attempting to get svg graphics with inner shadows but was saddened to see it didn't support it!
     
  21. silentneedle

    silentneedle

    Joined:
    Mar 14, 2013
    Posts:
    280
    Wouldn't that break anything?
     
  22. jocyf

    jocyf

    Joined:
    Jan 30, 2007
    Posts:
    252
    Can be SVGRenderer can be faded (changing the color.alpha) using tween??? I've tried using Dotween but it doesn't work.
    Code (CSharp):
    1. DOTween.ToAlpha(()=> mySVG.color, x => mySVG.color = x, 0, 1);
    where my SVG is an SVGRenderer.
    At the end, I used a regular lerp instead... :(

    Code (CSharp):
    1.  
    2. shadowColorAux = mySVG.color;
    3. shadowColorAux.a = Mathf.MoveTowards(shadowColorAux.a, shadowColor.a, fadeSpeed*Time.deltaTime);
    4. ...
    5. ...
    6. ...
    7.  
    Solved ! (There was other code involved undoing the DOTween animation... so now it works ...)
     
    Last edited: Aug 1, 2016
  23. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    Unity UI Canvas "Unity 5.2" batches approx 65 vertices which is in theory 1 drawcall, if you would have more vertices it would produce more drawcalls. It is not dependent on how many different SVG files do you use, so there is no benefit of having only one SVG file or multiple SVG files. It is purely convenient to choose the color directly in Unity and not in the graphics program and if you want to reduce drawcalls then reduce the amount of vertices - reduce quality or reduce the amount of used instances. Hope that helps.
     
  24. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    Hello,
    I can for sure say that filters are not on the roadmap. The reason for this is performance, doing realtime filters on GPU requires a lot of resources. First, you have to separate different layers in to different groups, than you have to rasterise them in different render textures, then you have to apply different filters on every render texture with the filter and then you have to compose all layers. This requires so many steps that every time you would like to scale or zoom your SVG we would need to recompute the whole image with this process. It is much faster to rasterise the filter effect during your export for example using a sprite instead of doing this in realtime.
    Hope that helps!
     
  25. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    I ment the SVG Importer Standard Shader. if you are not using it then not.
    I solved this error in the new version.
     
    silentneedle likes this.
  26. nialltl

    nialltl

    Joined:
    Jul 30, 2016
    Posts:
    5
    @Jaroslav, thanks for the filter explanation, that makes a lot of sense. In this case I will switch back to sprites for the majority of cases.

    One further question, how exactly does the SVG StrokeRenderer work? Is it possible to create strokes via code and render them using the StrokeRenderer, or change stroke settings on an imported SVG with it?
     
  27. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    You can use Stroke Renderer Legacy
    which has right now direct point input array field so it is much easier to work with.
    SVG Stroke Renderer is right now under development.
     
  28. Burglebutt

    Burglebutt

    Joined:
    Jul 24, 2014
    Posts:
    44
    This asset is great but for some reason when I build for android some of the gradiants appear to be white. Does anybody know how I can fix this issue? Thank you.
     
  29. Burglebutt

    Burglebutt

    Joined:
    Jul 24, 2014
    Posts:
    44
    I think I figured out my issue. For anyone else who has a Samsung Galaxy s6 I had to uncheck the Auto Graphics API button in the Project settings. Then I deleted the OpenGLES 3 and left only OpenGLES2 now it seems to work!
     
    raydekk and ElKrullo like this.
  30. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    949
    From one of the videos I see that you can create animations by cycling between several SVG asset files. Is there an option to make the animation smoothly tween between the positions of SVG lines/objects between two frames?
     
  31. nialltl

    nialltl

    Joined:
    Jul 30, 2016
    Posts:
    5
    Cool, thanks - how do I get access to the legacy strokerenderer? It doesn't seem to be included in the SVG Importer package right now.
     
  32. waxx

    waxx

    Joined:
    Apr 1, 2013
    Posts:
    31
    Anyone else having weird pivot displacement problems with Unity 5.4? Importer works fine on earlier Unity versions.
     
  33. raydekk

    raydekk

    Joined:
    Mar 14, 2013
    Posts:
    72
    I have the same issue since Unity version 5.2.x. Tested it up to 5.4.0p1 and it's still there. I'm going to make a sample project and post a bug report on the Unity Issue tracker.

    Removing the OpenGLES3 is a quick fix, yes - but I'd like to take advantage of the performance improvements.

    UPDATE: I got a reply from Unity:
    (Case 823988) [Android] OpenGLES3 gradient issue
     
    Last edited: Aug 19, 2016
    jasonMcintosh likes this.
  34. raydekk

    raydekk

    Joined:
    Mar 14, 2013
    Posts:
    72
  35. omobono

    omobono

    Joined:
    Dec 7, 2015
    Posts:
    2
    Hi there.
    I have just purchased the plugin and trying to dynamically alter the SVGRenderer's vectorGrapjic instance at runtime (for a sort of slideshow). It works but the new svg asset displays pink. Any ideas what might be going wrong with the rendering?
     
  36. kaly

    kaly

    Joined:
    Apr 30, 2014
    Posts:
    1
    Hi, I deleted the OpenGLES 3 and left only OpenGLES2 but no work :(, any idea?
     
  37. 11clock

    11clock

    Joined:
    Jun 2, 2015
    Posts:
    22
    There is a bug in the in-IDE runner. If you copy prefabs of an SVG into the scene without a prior SVG being in the scene, the graphic looks like a solid purple on the second time you play the game and onwards.



    Can confirm that this only happens in the in-IDE runner. Built projects work fine.
     
    Last edited: Aug 25, 2016
  38. jasonMcintosh

    jasonMcintosh

    Joined:
    Jul 4, 2012
    Posts:
    71
    @Jaroslav-Stehlik It would be great if you could release a hotfix build to resolve some of these bugs instead of waiting a long time for the new features to be ready. I'd certainly appreciate that. :)
     
  39. waxx

    waxx

    Joined:
    Apr 1, 2013
    Posts:
    31
    For those interested in the pink asset issue:

    Create an SVG Material with one of the plugin's shader and directly hook it up to SVGRenderer - it will work every time.
     
  40. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    919
    @Jaroslav-Stehlik
    I'm facing problem with SVG
    I made a swtich and in Unity Editor 5.4 (Mac Retina) it shows it fine.
    However when i deploy the app it distort it even though im using 9 scaling.
    Please check both images and let me know the issue.
    Thanks
     

    Attached Files:

  41. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    919
    Second question is about next version of SVG, its almost 6 months without any update.
    Thanks
     
  42. Korindian

    Korindian

    Joined:
    Jun 25, 2013
    Posts:
    452
    It seems the developer doesn't get forum notifications sometimes, so if you need to reach him, perhaps contact him via email. He usually responds pretty promptly. If you do, maybe tell him to check the forum thread.
     
  43. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    919
    i have emailed him, lets see how much time he take to respond ;)
     
    Korindian likes this.
  44. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    919
    Its Friday now :/
     
  45. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    919
    I can see that he visited this forum last month, not getting notifications is understandable but unable to see the form for a month is just a lame excuse. if i were him, i'd have visitng my support page once a week if not once a day. and here it is not even once a month.
    As i have already emailed him, ill wait for another day otherwise will remind him on asset store link to PLEASE visit support page.
     
    eepromm99 and Korindian like this.
  46. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    Hi there,
    Could you verify how do you have setup the Canvas scaling?
    Also, do you have the latest beta version?
    I will promptly send it to you.
    Have a nice day.
     
  47. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    Hello,
    I fully agree, but in the hotfix itself there is some issue with instancing
    which I am trying to resolve.
    I would make and update today and will see if we can resolve the instancing issue together.
     
    jasonMcintosh likes this.
  48. v2-Ton-Studios

    v2-Ton-Studios

    Joined:
    Jul 18, 2012
    Posts:
    183
    Hey guys -- looks like a great tool.

    Quick question: Can I export an llustrator file such that each layer (or maybe group) exports as a separate SVG, rather than just one SVG?

    TIA!
     
    shaneparsons likes this.
  49. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    919

    @Jaroslav-Stehlik
    I'm facing same issue even with Beta 1.11 RC
    Canvas scaling is "Constant Physical Size".

    Please advise.
     
  50. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    Hi!
    This should do do export of individual layers,
    http://www.tbyrne.org/export-illustrator-layers-to-svg-files