Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Let us know a bit about your interests, and if you'd like to become more directly involved. Take our survey!
    Dismiss Notice
  4. Don't miss out on the Unite LA Keynote for the latest information from Unity! Set a reminder!
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  6. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

SVG Importer | Vector Graphics | Unity UI Supported [RELEASED]

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

  1. shaneparsons

    shaneparsons

    Joined:
    May 5, 2015
    Posts:
    41
    Awesome, glad to hear! I personally am not aware of any distribution channels... but let me know when you have something up and running and I'll test it!
     
  2. pl_ayground

    pl_ayground

    Joined:
    Dec 17, 2015
    Posts:
    56
  3. royvaneijndhoven

    royvaneijndhoven

    Joined:
    Jun 1, 2017
    Posts:
    42
    Killian, I see that you're importing them while having UWP selected in the Build Settings. This causes problems in the SmallXMLParser class that SVG Importer uses because it can't use some Unicode methods or something. You can comment out that part of the code but you'll lose the functionality to create SVG Assets during runtime so we have had to write our own code to work around that.

    TLDR;
    You'll be able to import the files if you temporarely switch to the Standalone Windows platform or rewrite some part of the SmallXMLParser class.
     
  4. JaimeAL

    JaimeAL

    Joined:
    Dec 4, 2015
    Posts:
    21
    If you need beta testing of a new SVG Importer version feel free to send it and I will implement it into my project see if it breaks or not. Any new and improved versions are always welcome ^^
     
  5. crdmrn

    crdmrn

    Joined:
    Dec 24, 2013
    Posts:
    37
    As far as I know, if you upload a new version on the asset store, unity will detect the files that are changed when trying to reimport the asset in the project (those will be the only one selected in the drop down menu) :)
     
  6. killianChicoisne

    killianChicoisne

    Joined:
    Jul 5, 2017
    Posts:
    2

    Hi, Thanks for your reply.
    You are right on this, if I import my svg files with other build settings, this work perfectly.
     
  7. Gingerbeer

    Gingerbeer

    Joined:
    Aug 10, 2015
    Posts:
    4
    Thank you very much. It works!!
     
  8. coshea

    coshea

    Joined:
    Dec 20, 2012
    Posts:
    241
    No, I would maintain a separate email list, ask people that want to be on the beta to email you with their Asset Store order number (so you know they have it) and send out the beta that way.

    I'd happily test and feedback too.
     
    shaneparsons likes this.
  9. crdmrn

    crdmrn

    Joined:
    Dec 24, 2013
    Posts:
    37
    Also, @Jaroslav-Stehlik, when using SVGImages on a ScreenSpace-Overlay Canvas, the UIAntialiased shader has no effect, when switching to ScreenSpace-Camera and assigning a Camera to the Canvas then it works.
    My guess is that, as a ScreenSpace-Overlay Canvas is way bigger than a ScreenSpace-Camera one, the antialiasing is just not visible and results in sharper edges. any idea on how to fix this?
     
    shaneparsons likes this.
  10. shaneparsons

    shaneparsons

    Joined:
    May 5, 2015
    Posts:
    41
    Yeah, this is part of the problem I've been having as well. I'm hoping Jaroslav's new shaders fix it.
     
  11. mmvlad

    mmvlad

    Joined:
    Dec 31, 2014
    Posts:
    73
  12. mmvlad

    mmvlad

    Joined:
    Dec 31, 2014
    Posts:
    73
    @Jaroslav-Stehlik in SvgImage OnPrepareForRendering is never called.
    Please some help
     
  13. shaneparsons

    shaneparsons

    Joined:
    May 5, 2015
    Posts:
    41
    @Jaroslav-Stehlik I desperately need the anti-aliasing to work. I needed it when I started this project over 2 years ago, and I need it now more than ever that we're about to make some big distribution deals. I've been patient for a very long time now... Please give me something to work with... anything at all.
     
    royvaneijndhoven likes this.
  14. shaneparsons

    shaneparsons

    Joined:
    May 5, 2015
    Posts:
    41
    Update: In the meantime, I was able to switch from Screen Space - Overlay to Screen Space - Camera all across the game without causing too many issues, which made everything look slightly better. Additionally I've disabled SVG Importer's anti-aliasing on all SVG Images, and cranked up Unity's to 8x, which also helped quite a bit.

    It's not the perfect solution, because not everybody can use Screen Space - Camera, but in my case it helped quite a bit.
     
    tosiabunio likes this.
  15. raydekk

    raydekk

    Joined:
    Mar 14, 2013
    Posts:
    64
    I'd like to test the new beta version as well. I've bought SVG Importer a long time ago and it's a top tier tool.
    Got a published app using SVG Importer with Unity 5.6.x on both iOS and Android and looking to try the beta with the latest Unity LTS version (2017.4)

    Also had an issue open @ the issue tracker for ages now related to gradient rendering on certain devices like a Galaxy S6, workaround being only forcing openGL ES2 on all devices (https://issuetracker.unity3d.com/is...-incorrectly-on-android-devices-with-mali-gpu). Hope a SVG Importer update will fix it, since Unity set the issue status to "Won't fix".

    I will PM you with my email address, thanks for your work on this wonderful asset.
     
  16. HollyManolly

    HollyManolly

    Joined:
    May 14, 2014
    Posts:
    6
    Hello guys, we recently bought this tool and got stuck on these weird issues.
    Some of the assets dont get imported properly. Here's an example of this. The first one is how it's designed, the second is after Unity's import.
    good.png bad.png
    I went through this thread and found a similar issue but haven't managed to find a solution.

     
  17. shaneparsons

    shaneparsons

    Joined:
    May 5, 2015
    Posts:
    41
    In the example you provided, I'd image that expanding the strokes to objects (mountain) in your design program will probably fix the issue. What program are you using?
     
  18. Aduviel

    Aduviel

    Joined:
    Feb 18, 2016
    Posts:
    3
    Hi all,

    We've just imported the latest version of SVGImporter (1.1.6) on a machine with an older unity install. What exactly does "ignore SVG Canvas" do? We would like the canvas size (and any whitespace) to be respected as we are doing animations using the SVG Frame Animator. When we un-check "Ignore SVG Canvas", the SVG/mesh is not rendered. Is anyone able to help? do we need to copy/paste any hotfixes into the SVGimporter source code or do we just need to update Unity? Our unity version is: 2017.3.1f1.
     
  19. RacistWhale

    RacistWhale

    Joined:
    Jan 25, 2018
    Posts:
    1
    I am using the most recent version of unity.
    Why can i not use .svg assets in my tilemap?

    https://docs.unity3d.com/Manual/Tilemap-TileAsset.html
    Says that "Typically, Tiles are actually Sprites that are arranged on a Tilemap."
    And
    https://assetstore.unity.com/packages/tools/sprite-management/svg-importer-38258
    Says that "SVG importer fully mimics Unity native sprites so your team doesn't have to learn anything new."

    So the tilemap should work with svg assets considering that they are sprites but if I drag the svg asset into the tile pallet nothing happens. So i'm not sure where i can go from here, please help.
     
    Last edited: May 26, 2018
  20. Tapitone74

    Tapitone74

    Joined:
    Sep 20, 2014
    Posts:
    3
    When I use Modifiers ( twirl,sphere..) if the material is Sprite Diffuse , the Image becomes very dark, can't recieve lights. There is a way to solve this problem?
     
  21. royvaneijndhoven

    royvaneijndhoven

    Joined:
    Jun 1, 2017
    Posts:
    42
    @Jaroslav-Stehlik

    Will we get an update that improves Anti-Aliasing in the near future? We're running into a couple of problems that have been posted in this thread multiple times already and the once in a month replies don't really assure that those will be taken care of. A colleagae has tried to contact you through mail but has not received a response.

    Some of the weird behaviour that anti-aliasing causes is described below;
    1. Scaling a SVG Renderer or SVG Image makes it blur way to much, so much that it turns into one big blob.
    2. Increasing the Orthographic Size on a Camera does the same thing but only applies to SVG Images.

    These things create weird side effects in our project. For instance, we fade away objects (SVG Renderer) by slowly scaling objects down and then masking the removal by a particle effect but the anti-aliasing causes flashes because of the asset going wild and spiking when it's nearing a certain scale. A work around that we could use is disabling anti-aliasing when the scale reaches a pre-set point but this will disable anti-aliasing in it's entirety and the player will notice that all the other objects are aliased for a small amount of time.


    The reason we use SVG Importer is because SVG assets would retain their quality no matter how far you zoom in or out. Combine that with the built-in anti-aliasing which is actually better than the Unity anti-aliasing which applies anti-aliasing on everything in the scene. Using other anti-aliasing methods might not be possible for us because we're developing for very specific hardware.
     
    shaneparsons likes this.
  22. AlexHell

    AlexHell

    Joined:
    Oct 2, 2014
    Posts:
    50
    May be I can help you. First point is what SVG converted to concrete scale, for example 5x, importer creates mesh for 5x quality with some vertex count and triangle count. If you scale greater than 5x, the mesh can't be rendered like in flash or adobe illustrator, because of vertex count. It's not aliasing, it's vertex count. With SVG Importer you can't take universal scaling, like in flash or illustrator. If you need bigger scale than 5x, you should select VertexPerMeter (VPM, QUALITY) in mesh importing process, for example 5000-10000 etc, and this mesh can be scaled to bigger scale, but not to arbitrary.
     
  23. AlexHell

    AlexHell

    Joined:
    Oct 2, 2014
    Posts:
    50
    In my experience, MSAA is great for SVG Importer. But geometry AA is broken, I can't remember any version with worked geometry AA from SVG Importer. Better use MSAA.
    p.s. Also if you need to disable MSAA partially, you can make two cameras, one with MSAA enabled, and one with disabled, you can progrrammatically change MSAA enabled option on camera, and render specific gameObjects with specific camera by layer index (not 100% sure it work out-of-the-box with importer).
     
  24. oscarlosu

    oscarlosu

    Joined:
    Mar 4, 2015
    Posts:
    9
    Hi @Jaroslav-Stehlik,
    We use Adobe Animate to make svg animations, which are exported frame by frame and rendered in Unity using SVG Importer. This works fine in most cases, but some of our animations need to tween colors. For that, we are using color effects, and those are apparently not working in SVG Importer?

    You can reproduce the problem with the test file attached. If you open it with a browser, yo should see a transparent brown rectangle, but SVG Importer renders it as an opaque brown rectangle, regardless of the import settings.

    Is this feature not supported? Are there any workarounds you know about?
     

    Attached Files:

  25. Ssssilk

    Ssssilk

    Joined:
    Jul 28, 2014
    Posts:
    12
    I, too, am struggling to get the lights to work properly with the imported SVGs.

    Has anyone been able to do so lately?

    I was following these steps, not sure if there's something newer to follow from:


    Thanks.
     
  26. tosiabunio

    tosiabunio

    Joined:
    Jun 29, 2010
    Posts:
    93
    You have to disable anti-aliasing during SVG import and change the shader in your material:



    Although the representation isn't valid as some elements are becoming translucent for some reason. You need to investigate this more.
     
    Last edited: Jun 12, 2018
  27. startleworks

    startleworks

    Joined:
    Jun 8, 2013
    Posts:
    33
    guys check first post
     
  28. syamilsynz

    syamilsynz

    Joined:
    Dec 22, 2013
    Posts:
    29
    Hi @Jaroslav-Stehlik ,

    I got an issue from svg image in unity 2018 after upgrading my project from 2017.

    the ui svg image got weird behaviour, it have weird position and scaling without even edit the value.

    When I set deactive and activate again the gameobject contain ui svg image, it cause a weird problem. Then if I disable the svg image on the inspector, the gameobject is okay. But it just temporary. When I play the editor, the weird behavior occurs again.

    Here is the screenshot of the problem during set active gameobject false into true, and set active svg image false into true.

    How to fix this bug? thank you.
     
  29. silentneedle

    silentneedle

    Joined:
    Mar 14, 2013
    Posts:
    271
    Is there a problem with the anti-aliasing?

    This is how it looks on my end (using Unity 2017 LTS @ MacOS):

    https://imgur.com/a/LIxwVhv

    Strangely it works in the editor window.
     
  30. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    482
    The demo uses really old asset serialization so I think it is only related to the demo.
     
  31. Jindrich-Regal

    Jindrich-Regal

    Joined:
    Nov 22, 2013
    Posts:
    6
    We have exactly the same issue in Unity 2018.
     
  32. akwaahenkan

    akwaahenkan

    Joined:
    Mar 24, 2015
    Posts:
    2
    Hi guys. I am about to purchase the svg importer. But I wanna know something. Does it support shadow effects?
    For instance, if I import an svg asset from illustrator and it has shadows, will svg importer render the shadows?
     
  33. C_p_H

    C_p_H

    Joined:
    Nov 24, 2014
    Posts:
    97
    @akwaahenkan

    According to page 4 in the manual it appears that shadows will need to be vectorized prior to import, however Unity has the capability to cast shadows on or from SVG imports.

    supported features

    - Linear Gradients
    - Radial Gradients
    - Symbols
    - Clip Paths "experimental" - Cutouts

    - Strokes
    - Complex Shapes

    unsupported features

    - Masks “SVG mask will no be supported due to hardware limitations”
    - Text “most graphics editors can convert text to curves”
    - Filter Effects “Does not mean that we can not use custom shaders in the future”
    - Animation
     
  34. v_Jay_v

    v_Jay_v

    Joined:
    Feb 13, 2016
    Posts:
    27
    Is antialiasing support planned for screen space overlay canvas?
     
  35. akwaahenkan

    akwaahenkan

    Joined:
    Mar 24, 2015
    Posts:
    2
    Very useful asset, however, it would be better if you included scripting documentation.
     
  36. shaneparsons

    shaneparsons

    Joined:
    May 5, 2015
    Posts:
    41
    I hope so... In the meantime, you could try using Screen Space - Camera. See the excerpt from a previous post below for more info.

    "In the meantime, I was able to switch from Screen Space - Overlay to Screen Space - Camera all across the game without causing too many issues, which made everything look slightly better. Additionally I've disabled SVG Importer's anti-aliasing on all SVG Images, and cranked up Unity's to 8x, which also helped quite a bit.

    It's not the perfect solution, because not everybody can use Screen Space - Camera, but in my case it helped quite a bit."
     
    v_Jay_v likes this.
  37. Thor_e

    Thor_e

    Joined:
    Sep 4, 2015
    Posts:
    14
    I want to combine the SVG sprite with the cloth component, which works and would be amazing, but unfortunately, this method also spams this error.

    MissingReferenceException: The object of type 'MeshRenderer' has been destroyed but you are still trying to access it.
    Your script should either check if it is null or you should not destroy the object.
    SVGImporter.SVGRenderer.OnWillRenderObject () (at Assets/SVG Importer/Plugins/Core/SVGRenderer.cs:336)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)

    I know it's probably an unorthodox method, but has someone an idea how to fix this error (since the principle works). Alternatively, does anyone know how to use mesh deformations (as used for cloth and also for spine-based 2D), yet combined with SVGs?
     
    Last edited: Sep 15, 2018
  38. v_Jay_v

    v_Jay_v

    Joined:
    Feb 13, 2016
    Posts:
    27
    Thank you Shane. Unfortunately in my case I require Screen Space Overlay. After reading your solution earlier on, I ran a demo project with screen space camera and everything looked awesome. For now I will stick to sprites and hopefully in the near future, will be able to swap over to SVGs.
    Unity's upcoming Vector Graphics Package is looking good, tho UI support could be a long way off.
    Thanks again
     
  39. xqtr123

    xqtr123

    Joined:
    Jun 7, 2014
    Posts:
    14
    Hi!
    I'm trying to use Particle System with SVG Importer, but it changes the color of the particles (red blood) to the colors of the SVG background (sky blue). What am I missing?
     

    Attached Files:

  40. royvaneijndhoven

    royvaneijndhoven

    Joined:
    Jun 1, 2017
    Posts:
    42
    @Jaroslav-Stehlik Any updates? You were talking about a new version of the plugin that needed testing? We're all really curious.
     
  41. C_p_H

    C_p_H

    Joined:
    Nov 24, 2014
    Posts:
    97
    @Jaroslav-Stehlik
    Maybe Discord.
     
    Last edited: Sep 28, 2018
  42. C_p_H

    C_p_H

    Joined:
    Nov 24, 2014
    Posts:
    97
    His Anti-Aliasing vid might contain some helpful clues.
     
  43. HaNioL

    HaNioL

    Joined:
    Jun 20, 2013
    Posts:
    3
    Hi @Jaroslav-Stehlik thanks for being so honest about the reasons for not spending that much time working on the plugin, really appreciate your sincerity and openness. Having said that, my graphic designer found a couple issues with assets imported with SVG Importer, which consisted in assets appearing pixelated. After changing different parameters to try and find out what was the issue, I found the following:
    - When using Canvases in the screen space overlay, the SVG images get pixelated unless the main camera is orthographic and the size is 300 (the bigger the size the smoother it gets until 300, then it starts getting completely blurry).
    - When I switch the exact same camera with all the SVG images to screen space camera and assign a camera to it, the pixelation issue gets automatically resolved, it looks like when in screen space overlay the antialiasing is not working at all.
    Hope you can give me insight on this issue and hopefully a solution that doesn't involve changing all the canvases to screen space camera :O. Thank you!
     
    Last edited: Oct 8, 2018
    tosiabunio likes this.
  44. ReaktorDave

    ReaktorDave

    Joined:
    May 8, 2014
    Posts:
    90
    Something happened between Unity 2017.4.7 and 2017.4.12 - a lot of our SVGs that worked flawlessly before are now being imported as empty graphics. Also, viewing multiple of these empty graphics in the preview window selecting them one after another in the project tab crashes the Unity editor. Something is rotten there and it prevents us from updating.