Search Unity

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

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

  1. aitchest-of-dees

    aitchest-of-dees

    Joined:
    Dec 28, 2013
    Posts:
    73
    Hey, I just want to triple check -- your description says this plugin is *fully* cross platform, so I'm taking that to mean Windows, Mac, Linux, Android, IOS as well as game consoles such as Xbox One?
     
  2. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    Hi there,
    I managed to actually import the document correctly, the problem is that there is another graphics
    a green triangle, if you delete the green triangle to have the start separate
    it should be much easier to work with that shape.
     
  3. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    Hi there,

    Actually, that is not possible because SVG Importer does not use textures.
    But it is possible to render the background into a texture and then assign
    that texture to a material and then you can scroll it this way.

    There is a function for rendering SVG to a Render Texture

    Code (CSharp):
    1. using SVGImporter
    2.  
    3. void Awake()
    4. {
    5.    // this returns the rendered render texture in desired resolution.
    6.    SVGRenderTexture.RenderSVG(yourSVGAsset, yourTextureResolutionRect);
    7. }
    8.  
     
  4. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    I can say that it was tested by many users on all iOS devices, many Android devices, OSX, Windows. Windows Phone
    It was not tested on Linux and it was not tested on consoles.
    The only thing which can do problem on some devices are gradients,
    but there is an easy fix for these devices. If you do not use gradients, you
    are 100% good to go, if you use gradients. Just contact me when you came
    up with any problems. We always solve that quite fast.
     
  5. JaimeAL

    JaimeAL

    Joined:
    Dec 4, 2015
    Posts:
    21
    I would love to agree on this, but despite the understandable delay on replying (because of your final push to publish Mimpi Dreams) we did not solve the issue quite fast. In fact, we had to completely discard gradients on SVGs to not glitch on mobile devices.

    Things the way they are! We love the plugin, but this issue had us lost a couple of weeks of work trying to fix something out of our scope and then replacing all gradients back to plain colors with numerous testings in between.

    Gradients seem to work perfectly on PC platforms tho, so if you do not use gradients you are 100% good to go, if you plan on using them on mobile devices make an early test and play your game switching scenes for around 15 minutes and test if at some point the colors start glitching. The more gradients you use, the more likely for them to break when switching to a scene and reloading them.

    At least that was what happened to us.
     
    Last edited: Mar 11, 2016
  6. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    Thank your for your information!

    It is a must have to have a visual tweaking settings for the gradients!
    At least Mimpi Dreams would be released this week so SVG Importer would continue
    at much faster update rate from now on.
     
  7. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    Last edited: Mar 16, 2016
  8. _The_Observer

    _The_Observer

    Joined:
    Nov 8, 2014
    Posts:
    1
    Congrats with the release of Mimpi Dreams!

    I've bought SVG Importer this week for a freelance job and I'm still finding my way with it.
    Today I've unfortunately encountered an issue when I add a second object with SVG Renderer attached.
    When I do this a part of the background (a light ray) lights up more strongly. The second object in this case is a glass with a transparant material. It doesn't happen with any object though, for example not with a solid piece.

    I've attached screenshots, any idea what might cause this?
     

    Attached Files:

    Jaroslav-Stehlik likes this.
  9. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    Hi,

    Thank you! Could you send me the SVGs on my mail?
    http://svgimporter.com/contact/

    This looks strange, I would like to investigate it.
     
  10. Vertigodown

    Vertigodown

    Joined:
    Feb 20, 2016
    Posts:
    1
    I just downloaded and attempted to install for the first time. Im getting the following error.

    Assets/SVG Importer/Plugins/Core/Mesh/SVGMeshUtils.cs(805,18): error CS1061: Type `UnityEngine.Mesh' does not contain a definition for `uv3' and no extension method `uv3' of type `UnityEngine.Mesh' could be found (are you missing a using directive or an assembly reference?)

    Checked for new version and it says it is up to date. 4.7.0f1

    Any suggestions?

    Thanks
     
  11. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    I replied you by email.
    This is probably because you have plugin version for newer Unity and run it on older version of Unity.
     
  12. Ghopper21

    Ghopper21

    Joined:
    Aug 24, 2012
    Posts:
    170
    Hi Jaroslav - congrats on the release of Mimpi Dreams, I like the art style -- I presume you used SVG Importer :)

    Question about the SVG Renderer's material. I'm trying to add a bitmap texture to show as the fill within the SVG shape. When I add a material with such a texture, all I get is a solid color based on the texture. I suspect I've got some scale factor wrong so that it's rendering the material too zoomed in. How can I fix this?
     
  13. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    Hello there!
    Thank you that you like Mimpi Dreams.

    This function is not supported right now and it is due to UV mapping which works in favour of gradients
    but not custom textures. This feature is on the list because there is a high demand for having texture overlays
    on vector graphics which makes sense.
     
  14. Ghopper21

    Ghopper21

    Joined:
    Aug 24, 2012
    Posts:
    170
    Ah ok thanks. Any ETA on this feature? And when you release that, how will it work for rectangular bitmap textures on non-rectangular SVG shapes?
     
  15. Gingerbeer

    Gingerbeer

    Joined:
    Aug 10, 2015
    Posts:
    24
    Hello Jaroslav Stehlik,

    Thank you for fantastic add-on, it works great in Unity but when I run my game on my phones (both Android and iOS) I found the problem.

    My game use a lot of SVG for background and everything looks good until I start jumping between scenes for a few minutes (about 10 - 15 minutes) all background turn white.

    I would like to know how to fix this issue.

    Cheers!

    PS. the shop and some objects in foreground are SVG too but they are fine.

    Screenshot_2016-03-28-15-31-03.png Screenshot_2016-03-28-15-31-10.png
     
  16. JaimeAL

    JaimeAL

    Joined:
    Dec 4, 2015
    Posts:
    21
    We had this issue and a lot of color glitching when using gradients and transparency gradients on our SVGs (only on mobile devices). After removing all the gradients on all the SVGs the app would not glitch anymore.

    If your colors are glitching without using gradients then that´s new!

    It is a quick crappy fix to remove the gradients, but until it either gets fixed or a workaround is discovered seems to be the better choice (at least for us)
     
  17. Gingerbeer

    Gingerbeer

    Joined:
    Aug 10, 2015
    Posts:
    24
    Yay sounds good!

    I'll try as you suggested, thank you very much!
     
  18. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    Hello,

    this is a known bug. Please contact me via email to receive a hotfix.
    http://svgimporter.com/contact/
    Thanks!
     
    Gingerbeer likes this.
  19. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    Please contact me to receive an hotfix so we can proceed this bug and send it to Asset Store.
    Thanks.
     
  20. ElKrullo

    ElKrullo

    Joined:
    Feb 24, 2013
    Posts:
    17
    Hello Jaroslav,

    Any idea how far away the UV-mapping feature for SVG Importer could be? It's number 1 on my wish list. :)

    Congrats on the release of Mimpi Dreams by the way, it was really nice!
     
  21. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    Hello!

    I would personally think about 3 weeks. Is that ok for you?
     
  22. ElKrullo

    ElKrullo

    Joined:
    Feb 24, 2013
    Posts:
    17
    Definitely OK. Sounds great actually!
     
  23. youblistermypaint

    youblistermypaint

    Joined:
    Aug 5, 2015
    Posts:
    14
    So I bought SVG Importer awhile ago and after struggling with it for a little I put it on the shelf. Can anyone help with the following?

    • Is there any way to use an SVG spritesheet for animation? My artist works exclusively in SVG and hand animated all the assets and created SVG spritesheets. I couldn't figure out how to make use of these with this plugin.
    • My assets look worse using SVG Importer then my exported PNGs. I tested this on multiple mobile devices and in the Unity editor and in all cases the direct SVG import looked bad, might like a sprite with no filtering applied.
    Sorry I don't have screenshots about what I am talking about. Like I said I hit these issues awhile ago and then put SVG importer aside so I could continue working on my game.
     
  24. ElKrullo

    ElKrullo

    Joined:
    Feb 24, 2013
    Posts:
    17
    1. You can add a SVGFrameAnimator component to the game object which is used to switch between SVG sprites. This component can then be controlled from the animation timeline.
    2. In what way does the assets look bad? I'm guessing it's probably a question of jagged edges, in which case you need to apply antialiasing. If you select an imported asset there is an option to turn it on.
     
    Jaroslav-Stehlik likes this.
  25. youblistermypaint

    youblistermypaint

    Joined:
    Aug 5, 2015
    Posts:
    14
    Thanks for the answer. It was most likely me missing the anti-aliasing checkbox.

    For the SVGFrameAnimator, do you have to split each frame into a separate SVG or is there someway to treat an SVG like a spritesheet that I am missing?
     
  26. ElKrullo

    ElKrullo

    Joined:
    Feb 24, 2013
    Posts:
    17
    As far as I know, yes, you have to split it up in separate SVGs.
     
    Jaroslav-Stehlik likes this.
  27. youblistermypaint

    youblistermypaint

    Joined:
    Aug 5, 2015
    Posts:
    14
    These are some of the quality issues I am seeing,

    This simple balloon sprite, does not look bad up close:


    But when you zoom out a little, the SVG edges look noticeably worse.

    This is with antialiasing on and set to a width of 5.

    Similarly, this design looks even better then the PNG up close:


    But really bad when zoomed out a little:


    Note these tests are in the editor, but I've done on device tests in the past with a few different iOS and Android devices and gotten similar results.

    I am also hitting a lot of issues just importing my SVG assets. Many of them just don't show up post import, ie previous window says 0 vertices, 0 triangles.
     
  28. tiggert

    tiggert

    Joined:
    Nov 2, 2014
    Posts:
    1
    Hi all,

    First a huge "Thanks" for providing this asset. It is a huge time and space saver!

    I've encountered an issue, probably a user error on my part but any help would be appreciated.

    Running latest Unity 5.3.4f1

    Issue is reproduceable in Editor, Android, iOS builds.

    I setup my app as a number of scenes, each using uGui to drive everything. The app is live on Google Play at the moment (http://bit.ly/1RqrA1y) we didn't catch the bug until now, feel free to have a look. Each scene uses Canvas and has a number of dialog, buttons, and such.

    This error can be recreated in our app by going from our Main Menu, clicking Play which takes you to the Levels Scene, the clicking home back to the Main Menu scene. If this is done repeatedly (I think it is around 7 round trips back and forth) the following error is thrown in editor:

    Texture rectangle is out of bounds
    UnityEngine.Texture2D:SetPixels(Int32, Int32, Int32, Int32, Color[])
    SVGImporter.SVGAtlas:RenderGradient(Texture2D, CCGradient, Int32, Int32, Int32, Int32) (at Assets/SVG Importer/Plugins/Core/SVGAtlas.cs:313)
    SVGImporter.SVGAtlas:AddGradient(CCGradient, Boolean) (at Assets/SVG Importer/Plugins/Core/SVGAtlas.cs:382)
    SVGImporter.SVGAsset:get_runtimeMesh() (at Assets/SVG Importer/Plugins/Core/SVGAsset.cs:144)
    SVGImporter.SVGAsset:get_sharedUIMaskMaterial() (at Assets/SVG Importer/Plugins/Core/SVGAsset.cs:282)
    SVGImporter.SVGImage:GetDefaultMaterial() (at Assets/SVG Importer/Plugins/Core/SVGImage.cs:540)
    SVGImporter.SVGImage:UpdateMaterial() (at Assets/SVG Importer/Plugins/Core/SVGImage.cs:587)
    SVGImporter.SVGImage:Awake() (at Assets/SVG Importer/Plugins/Core/SVGImage.cs:73)
    UnityEngine.GameObject:SetActive(Boolean)
    LevelButtonScript:setLocked() (at Assets/Scripts/LevelButtonScript.cs:25)
    LevelManager:configureButtons() (at Assets/Scripts/LevelManager.cs:204)
    LevelManager:Start() (at Assets/Scripts/LevelManager.cs:113)

    The result is an "ugly" color shift on all the svg screens:

    Noirmal:

    Capture.PNG


    Post error:

    CaptureUgly.PNG

    I'm sure I'm doing something wrong, checking to see if anyone else has experienced this as well?

    THANKS!
     
  29. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    Hello,

    I recommend to turn off antialiasing on the asset it self and try to turn on
    Unity native antialiasing in the settings.

    http://docs.unity3d.com/Manual/class-QualitySettings.html
    Set antialiasing to 4x

    hope that helps!
     
  30. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    This is a bug of Gradient Atlas which I am now working on almost for a week so you can send me an email to be one of the first who get a hotfix for this issue!
     
  31. The_Devil

    The_Devil

    Joined:
    Jun 6, 2015
    Posts:
    36
    Hi...I am looking to load SVG assets at runtime. Does the latest version have the patch for making it more efficient to load them at runtime?
     
  32. V4nKw15h

    V4nKw15h

    Joined:
    Dec 16, 2011
    Posts:
    47
    Hi, just bought and downloaded but I'm running into the same error another user mentioned above.

    `UnityEngine.Mesh' does not contain a definition for `uv3' and no extension method `uv3' of type

    I'm also using Unity 4.7. I understand that this issue is probably due to the plugin being downloaded for Unity 5.x but no matter what I do the asset store always downloads and imports the wrong version. How do I download the version for Unity 4?
     
  33. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    Hello,

    the SVG Import right now is still under heavy development.
    you can send me an email to test the beta. That's the only thing right now I can do for you.
     
  34. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    HI send me an email so I can send you latest beta version.
     
  35. V4nKw15h

    V4nKw15h

    Joined:
    Dec 16, 2011
    Posts:
    47
    Done. Sent via private conversation here on the Unity forums. Thanks.
     
  36. The_Devil

    The_Devil

    Joined:
    Jun 6, 2015
    Posts:
    36
    Do I have to purchase it before trying the beta?
     
  37. Vatis

    Vatis

    Joined:
    May 30, 2013
    Posts:
    2
    Hi Jaroslav,
    I tried to reach you through the feedback form on your web-site, but you didn't answer.
    Anyway, I use Unity 5.3.2.f1 and SVG importer 1.1.2. and have 2 main issues:

    1. When importing an SVG into Unity I'm getting next errors:
    a)
    SVG Document Exception: Object reference not set to an instance of an object
    UnityEngine.Debug:LogError(Object, Object)
    SVGImporter.SVGAssetImport:StartProcess(SVGAsset) (at Assets/SVG Importer/Plugins/Core/SVGAssetImport.cs:97)
    SVGImporter.SVGAsset:_editor_LoadSVG() (at Assets/SVG Importer/Plugins/Core/SVGAsset.cs:1410)
    SVGImporter.SVGAsset:_editor_ApplyChanges(Boolean) (at Assets/SVG Importer/Plugins/Core/SVGAsset.cs:1253)
    System.Reflection.MethodBase:Invoke(Object, Object[])
    SVGImporter.SVGPostprocessor:ImportVGAsset(String) (at Assets/SVG Importer/Editor/AssetPostprocessor/SVGPostprocessor.cs:210)
    SVGImporter.SVGPostprocessor:OnPostprocessAllAssets(String[], String[], String[], String[]) (at Assets/SVG Importer/Editor/AssetPostprocessor/SVGPostprocessor.cs:143)
    UnityEditor.AssetPostprocessingInternal:postprocessAllAssets(String[], String[], String[], String[], String[])
    UnityEditorInternal.InternalEditorUtility:projectWindowDrag(HierarchyProperty, Boolean)
    UnityEditor.DockArea:OnGUI()

    b)
    SVG Document is corrupted! Assets/Resources/floorPlans/floor4-6/units/new/4-6_A_02_3.asset
    UnityEngine.Debug:LogError(Object, Object)
    SVGImporter.SVGAssetImport:StartProcess(SVGAsset) (at Assets/SVG Importer/Plugins/Core/SVGAssetImport.cs:103)
    SVGImporter.SVGAsset:_editor_LoadSVG() (at Assets/SVG Importer/Plugins/Core/SVGAsset.cs:1410)
    SVGImporter.SVGAsset:_editor_ApplyChanges(Boolean) (at Assets/SVG Importer/Plugins/Core/SVGAsset.cs:1253)
    System.Reflection.MethodBase:Invoke(Object, Object[])
    SVGImporter.SVGPostprocessor:ImportVGAsset(String) (at Assets/SVG Importer/Editor/AssetPostprocessor/SVGPostprocessor.cs:210)
    SVGImporter.SVGPostprocessor:OnPostprocessAllAssets(String[], String[], String[], String[]) (at Assets/SVG Importer/Editor/AssetPostprocessor/SVGPostprocessor.cs:143)
    UnityEditor.AssetPostprocessingInternal:postprocessAllAssets(String[], String[], String[], String[], String[])
    UnityEditorInternal.InternalEditorUtility:projectWindowDrag(HierarchyProperty, Boolean)
    UnityEditor.DockArea:OnGUI()

    c)
    SVGAsset: 4-6_A_02_3
    errors: ClipPath, Syntax.
    path: Assets/Resources/floorPlans/floor4-6/units/new/4-6_A_02_3.asset
    UnityEngine.Debug:LogError(Object, Object)
    SVGImporter.SVGAsset:_editor_ApplyChanges(Boolean) (at Assets/SVG Importer/Plugins/Core/SVGAsset.cs:1301)
    System.Reflection.MethodBase:Invoke(Object, Object[])
    SVGImporter.SVGPostprocessor:ImportVGAsset(String) (at Assets/SVG Importer/Editor/AssetPostprocessor/SVGPostprocessor.cs:210)
    SVGImporter.SVGPostprocessor:OnPostprocessAllAssets(String[], String[], String[], String[]) (at Assets/SVG Importer/Editor/AssetPostprocessor/SVGPostprocessor.cs:143)
    UnityEditor.AssetPostprocessingInternal:postprocessAllAssets(String[], String[], String[], String[], String[])
    UnityEditorInternal.InternalEditorUtility:projectWindowDrag(HierarchyProperty, Boolean)
    UnityEditor.DockArea:OnGUI()

    SVG doesn't have any gradient but has transparency. Settings the same as you suggested: SVG 1.1 Fonts type: convert to outline.
    What could be wrong with SVG?

    2. Everything looks fine in the Unity editor and in builds for mac and win. But when I run the same build on Windows Surface pro, a moving plane with SVG becomes jittery and the whole screen looks jittery and blinking. I could send you a video directly.

    I hope for your help.

    Thanks,
     
  38. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    Hello,

    I sent you an email.
    Thanks for the report!
     
  39. ambethia

    ambethia

    Joined:
    Sep 29, 2014
    Posts:
    1
    Jaroslav,

    Does SVG importer triangulate the curve shapes on the fly, or so you use a loop-blinn style shader to render the curves? Just curious, thanks!
     
  40. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    hello,

    SVG Importer triangulates offline in the editor and also it can work during runtime.
    l had a lot of issues during experimenting with loop-blinn rendering
    the main problem was clip-paths and cutouts.

    But I would love to investigate this rendering method in the future.
    Do you have any experience with it? Thanks!
     
  41. raydekk

    raydekk

    Joined:
    Mar 14, 2013
    Posts:
    100
    Jaroslav,

    I have a weird bug with SVG Importer. There are currently 3 SVGs imported in Unity.
    When I import the 4th - every gradient in the first 3 turns white (there are no errors to report in unity) - all the other colors that are not gradients are ok. This happens only when I hit Play, in the Scene Editor everything is ok.

    Any idea what could cause this? Do you want me to send you the SVG?
    I'm on Unity 5.3.4 p1.

    Thanks
     
  42. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    Hello,

    this is a well-known bug on which I have hotfix.
    Please send me an email to get hotfix.
    Have a great weekend!
     
  43. raydekk

    raydekk

    Joined:
    Mar 14, 2013
    Posts:
    100
    I did, please send the hotfix.

    Thanks
     
  44. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    Done
     
  45. JaimeAL

    JaimeAL

    Joined:
    Dec 4, 2015
    Posts:
    21
    Quick doubt question thingy!

    Have you tried or considered using SVGs on asset bundles? We will probably be forced to get our SVGs on asset bundles for the new iOS app store 100MB limit *grumble*

    EDIT (22/04/2016): We just found that said limit is 3G download and larger apps can be downloaded through Wi-Fi, documentation was unclear so we are all fine now and won´t probably have to spend time with asset bundles, but it would be nice to know for future reference
     
    Last edited: Apr 22, 2016
  46. SwabbyNat74

    SwabbyNat74

    Joined:
    Oct 27, 2014
    Posts:
    17
    Realtime Import support?

    I've been trying to get the realtime import with a path to load in Unity, but keep getting ArgumentOutOfRange exceptions. These same SVGs ,if i drag them into Unity, will load just fine through the plugin, but i'm trying to store SVG's up on a server, and pull them directly into Unity.

    I have tried a myriad of things, prepending file://, etc. for local files that are outside the Unity project, as well as web hosted files, all to no avail with the realtime importer.

    Help?
     
  47. raydekk

    raydekk

    Joined:
    Mar 14, 2013
    Posts:
    100
    Hotfix works fine, thanks.

    However I ran into a weird bug on a galaxy s6 with android 6.0.1. It looks like all gradients are broken. On my note 3 with android 5.1 - it's working fine.
    I sent you an email with a screenshot. Any idea what could cause this?
     
  48. SwabbyNat74

    SwabbyNat74

    Joined:
    Oct 27, 2014
    Posts:
    17
    Am i missing something in the realtime importer for how it works? I've tried populating it with a string/path for files, both locally, as well as web based, and keep getting back errors. There's ZERO documentation i can find, so any help would be GREAT.
     
  49. DingoKing

    DingoKing

    Joined:
    Apr 24, 2016
    Posts:
    1
    I'm absolutely loving this asset so far. All of my images load and look super crisp and clean. My only problem is trying to figure out how to link the SVGFrameAnimator to the Animation window. The documentation just says that it's doable, but no instructions on how. Can anyone give a quick explanation?
     
  50. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    I think Asset Bundles should work without problems as well.