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. tacoilluminati

    tacoilluminati

    Joined:
    Oct 30, 2015
    Posts:
    6
    Hey y'all, found a workaround for this issue on SVG Importer 1.1.3 and Unity 5.5.0f3.

    Instead of solely removing the GradientColorAlphaBlendedAntialiasedCompressed shader, I also made a small change to remove that shader reference from the SVGAsset.cs, SVGAssetImport.cs, and SVGShader.cs scripts.

    Remove lines 28 - 35 from SVGImporter/Plugins/Utils/SVGShader.cs
    Code (CSharp):
    1. protected static Shader _GradientColorAlphaBlendedAntialiasedCompressed;
    2. public static Shader GradientColorAlphaBlendedAntialiasedCompressed {
    3.   get {
    4.     if(_GradientColorAlphaBlendedAntialiasedCompressed == null)
    5.       _GradientColorAlphaBlendedAntialiasedCompressed = Shader.Find ("SVG Importer/GradientColor/GradientColorAlphaBlendedAntialiasedCompressed");
    6.       return _GradientColorAlphaBlendedAntialiasedCompressed;
    7.     }
    8. }
    9.  
    Alter lines 1382 through 1385 to remove reference to the shader in SVG Importer/Plugins/Core/SVGAsset.cs, final code looks like:
    Code (CSharp):
    1. if(outputShaders[i].name == SVGShader.GradientColorOpaque.name ||
    2.   outputShaders[i].name == SVGShader.GradientColorAlphaBlended.name ||
    3.   outputShaders[i].name == SVGShader.GradientColorAlphaBlendedAntialiased.name)
    4.   {
    Same deal for lines 167 through 168 in SVG Importer/Plugins/Core/SVGAssetImport.cs - code will look the same as above. Don't forget to also delete the GradientColorAlphaBlendedAntialiasedCompressed shader!

    Now the game builds correctly and imports SVGs correctly.
     
  2. jocyf

    jocyf

    Joined:
    Jan 30, 2007
    Posts:
    252
    I noticed that changing the SVG Renderer.VectorGraphics or animating a SVGRenderer creates a huge GC Alloc in the profiler (depending on the mesh being asigned to the renderer).

    You can't do nothing about it, because that GC is caused by the SVGMeshUtils.Fill() function that is copying the mesh arrays (verts, colors, triangles, uv's and so on). That copy function is the origin of GC peaks and cant be avoided. It's something like this:

    destination.vertices = (Vector3[])source.vertices.Clone(); // This creates GC Alloc

    The only thing you can do is not animate nor change the vectorgraphics at runtime. The amount of memory will depend on the mesh data (how complex the mesh is).

    Take into acount that gradients (despite the last errors with shaders I see in this threath) are expensive too (the gradient calculations aren't free at all and you can see the cost in the profiller).

    SVG Importer is a great asset, but I am avoiding using certains features in my mobile game (it runs at 60 FPS and I must avoid CPU time calculations consuming & GC at all cost). So take into acount all that before using those GC -"feeding the animal"- functions.
     
  3. JaimeAL

    JaimeAL

    Joined:
    Dec 4, 2015
    Posts:
    21
    Hello, I have been messing with the quality settings of SVGs to improve performance/file size in Android and I started having some weird anti-alising issues when I reduced the quality setting on all SVGs

    Since "Antialising width" was moved from individual SVGs to be a global setting some assets stopped having antialising when they its enable and others change their SVG antialising width randomly when enabling/disabling the objects

    How it should be:


    When its antialising width gets weird:


    Surprisingly the more quality you give to the SVGs the less likely this will happen (to a point where it doesnt happen at all)

    Any idea as to why this might happen or if it could be an svg export issue? Anyone else had something similar? I can work around it and only occurs in some assets that we can individually tweak 'til fixed, it happens in both mobiles and desktop; but might be worth looking into.
     
  4. danimarti

    danimarti

    Joined:
    Oct 22, 2016
    Posts:
    15
    Hi, I purchased the asset and I'm having some doubts how to do a simple replacement/loading of SVGs by script.
    I'm sorry it that has been answered previously, it's hard to make searches here.
    I'm using the SVG in my GUI, so using sprites would be something like: GetComponent<Image>.sprite = Resources.Load<Sprite>("string");
    Can I do something similar but with the SVG? What namespace I have to use to be allowed to do that?
    Thanks so much!
     
  5. danimarti

    danimarti

    Joined:
    Oct 22, 2016
    Posts:
    15
    I have figured it out. If anyone is interested or knows a better way to do it:
    You need to call the namespace: using SVGImporter;

    And then something like:
    GetComponent<SVGImage>().vectorGraphics = Resources.Load<SVGAsset>("your_path");

    Thanks :)
     
  6. TallPaulS

    TallPaulS

    Joined:
    Dec 27, 2016
    Posts:
    1
    This may be a dumb question but I can't seem to find an answer anywhere, so here goes.

    Is there a way to get imported graphics to retain the original canvas size? Right now everything imported is basically "trimmed" meaning the white space surrounding the SVG is tossed out. This wreaks havoc with animations:

    1) If using SVG Image based animations on a canvas, then imagine animating a spinning star. At different frames the star's points will cause the source imported SVG to have different bounds but animations all start with a "base" object and because SVG image is beholden to canvas it resizes each frame to fit within the bounds of the primary image (so you get a spinning star that gets smaller/bigger).

    I finally "worked around" that one by using a standard SVG Renderer based image on game space and wrote the code to make it otherwise act properly like a canvas object.

    2) But then...SVG Renderer suffers from the same underlying issues when animating. There are certain types of animations that there is NO single pivot point that I could choose to help have the animation run smoothly without the image jumping due to some frames being "smaller" than others.

    I think I may have worked around this by adding a tiny square to each corner of my svg with alpha 1 (so it basically forces the imported SVG to maintain the original 100x100px settings I exported from Illustrator, and then there's no constantly going back to the artist to get a sequence that hopefully can be pegged to the bottom left).

    But these are kludges and with the rating of this asset I figure I am just being dumb here and there's something obvious I'm missing.
     
  7. WarpZone

    WarpZone

    Joined:
    Oct 29, 2007
    Posts:
    320
    I had a similar problem, trying to import bodyparts and clothing of an animated character from Flash.

    My own workaround was to export the whole character, then export each part, and line them up by hand in Unity with the view set to Wireframe. For joints, I'd export a version of the arm or leg or whatever with a little X where the center of the X has all 4 sticks of the X converging on a single point that's 0,0 of the Shape... basically a single vertex, made visible in Unity's Wireframe mode... and also put a bunch of X's on the torso. Then once it was in the right place I'd delete the X and reimport. Current location and offset and parenting all gets preserved because the shape outline is unchanged (The X is tiny and completely within the arm)

    I have no idea if you can do something similar in AI, but the basic techniques of drawing a cross where the dot of the Hot Spot should be and manually lining up the wireframes in Unity should transfer to almost any vector program.
     
  8. WarpZone

    WarpZone

    Joined:
    Oct 29, 2007
    Posts:
    320
    Is it possible to tint an SVG Renderer at runtime? I tried:

    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. Renderer cachedRenderer;
    4. cachedRenderer = MyGameObject.GetComponent<Renderer>();
    5.  
    6. cachedRenderer.material.color = Color.Lerp( fireColor, jumpColor, 0.5f );

    And that didn't work.

    I don't see anything about it in the documentation. This seems like REALLY critical functionality to have in a game.

    Edit: I figured it out. There wasn't a material assigned in the inspector. Derp.

    So now which material most closely approximates what happens when you choose no material? I want my SVG to be fullbright, not affected by lighting.
     
    Last edited: Jan 21, 2017
  9. Goodyearpimp

    Goodyearpimp

    Joined:
    Jun 5, 2014
    Posts:
    3
    New to SVG Importer, looking for some basic answers I couldn't find in the tutorial. Currently using Unity 5.0.2f1.

    Thank you in advance for anyone's help:

    + Downloaded the package from the asset store, not finding any of the demo projects (e.g., . Curves Demo). Downloaded 1 JAN 17. Why am I not finding it in my project after importing the #package, or as an optional project to load at Unity start?

    + When attempting to use a .SVG saved as instructed in the documentation, I can use it for 'SVG Renderer' but not 'UI SVG Image'. Error is as follows:

    NullReferenceException: Object reference not set to an instance of an object
    UnityEditor.PropertyHandler.OnGUILayout (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, Boolean includeChildren, UnityEngine.GUILayoutOption[] options) (at C:/buildslave/unity/build/Editor/Mono/ScriptAttributeGUI/PropertyHandler.cs:190)
    UnityEditor.EditorGUILayout.PropertyField (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, Boolean includeChildren, UnityEngine.GUILayoutOption[] options) (at C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:6740)
    UnityEditor.EditorGUILayout.PropertyField (UnityEditor.SerializedProperty property, UnityEngine.GUILayoutOption[] options) (at C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:6722)
    SVGImporter.SVGImageEditor.RaycastControlsGUI () (at Assets/SVG Importer/Editor/Core/SVGImageEditor.cs:283)
    SVGImporter.SVGImageEditor.OnInspectorGUI () (at Assets/SVG Importer/Editor/Core/SVGImageEditor.cs:110)
    UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor editor, Int32 editorIndex, Boolean forceDirty, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect, Boolean eyeDropperDirty) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1150)
    UnityEditor.HostView:OnGUI()
     
    Last edited: Jan 22, 2017
  10. JaimeAL

    JaimeAL

    Joined:
    Dec 4, 2015
    Posts:
    21
    You can do this with the color value just like you would on a SpriteRenderer

    ""using SVGimporter;

    (...)

    GetComponent<SVGRenderer>().color = new Color( your_color ); ""
     
    Jaroslav-Stehlik likes this.
  11. WarpZone

    WarpZone

    Joined:
    Oct 29, 2007
    Posts:
    320
    THANK YOU. I don't kow what the heck I was doing. Obviously I wasn't using any of the shaders that came with SVG Importer. (Where are the materials used in the demo?) I'll bet my game would have been nothing but hot pink on anyone else's computer!

    Edit: I get "The type or namespace name `SVGimporter' could not be found." What should I actually be using? And more importantly, where is the scripting documentation for this product?

    Edit edit: Figured it out. SVGImporter. Capitalization, lol.
     
    Last edited: Jan 25, 2017
  12. leenk

    leenk

    Joined:
    Oct 1, 2015
    Posts:
    6
    A technique we are using is to extract the mesh from the svg asset at runtime, and rewrite the color array. We use a simple color index system. We draw svg vector art using a pre-defined set of index colors (greys and magentas) and the then we map these to various palettes created by artists or procedurally generated. Colors not matching the canonical index tones are ignored and stay as drawn.

    Once you have extracted the mesh you can destroy the svg component and render the mesh in the "normal" way. This has been a very powerful way for us to use SVG Importer in our game, and allows for a great level of control and freedom. It's a great plugin.

    By the way, we had some small problems with Cloud Build after updating to Unity 5.5. This was fixed by deleting a couple of unused shaders.
     
    juanitogan likes this.
  13. AlexHell

    AlexHell

    Joined:
    Oct 2, 2014
    Posts:
    163
    We are finding a tool, which can read svg into inner svg-model in ram (not just convert to mesh and texture), also there is a need to manipulate svg at runtime, for example: change scale (from 1 to 10000), blending and etc, without artefacts and quality lost, like adobe flash. Does this tool do this?
    And how about performance on editing svg and rendering it at runtime (Does the 3d acceleration present? Will there be any lags?)
     
  14. WarpZone

    WarpZone

    Joined:
    Oct 29, 2007
    Posts:
    320
    Not in ram. It creates a mesh with solid color fills. Textures are only used for complex gradients. You can scale from 1 to 10000 and it looks just like it would in Flash, but you apply the scale using gameobject.transform or the SVG import settings. 3D acceleration happens just like with any other MeshRenderer. Shaders are very simple, file sizes are very small. Anti-aliasing can be done with shaders that come with SVG Importer.

    Can't edit SVG at runtime. Can load an external SVG. Does not import animation data, nested objects, etc. One SVG file = one mesh.
     
  15. WarpZone

    WarpZone

    Joined:
    Oct 29, 2007
    Posts:
    320
    Sorry to resurrect an ancient post, but how exactly does this work? I just want to swap out one "Vector graphics" object from my SVG Image (Script) at runtime. I know how to do this with Sprites, but I can't do it the same way I'd do it with Sprites because I don't know what class Vector Graphics is, and I don't know what packages I need to be using. This is with C# of course. Maybe the last guy to ask was using something else.
     
  16. JaimeAL

    JaimeAL

    Joined:
    Dec 4, 2015
    Posts:
    21
    "using SVGImporter;
    (...)

    void method( SVGAsset input_svg)
    {
    GetComponent<SVGRenderer>().vectorGraphics = input_svg;
    }"

    Changing SVGs in runtime; I gotta admit that it is not very intuitive; You can also use SVGFrameAnimator to swap within a list of SVGs
     
  17. seidensj

    seidensj

    Joined:
    Sep 10, 2014
    Posts:
    8

    I'm getting this error when I push to cloud build, causing the build to fail. Local builds work fine. Were you able to fix this problem?
     
  18. WarpZone

    WarpZone

    Joined:
    Oct 29, 2007
    Posts:
    320
    9-slicing doesn't seem to work at all. I sent a screenshot and my svg before and after import to the developer. No reply yet.
     
  19. JaimeAL

    JaimeAL

    Joined:
    Dec 4, 2015
    Posts:
    21
    Just in case, after import, step by step:

    > On the SVG's settings you should open SVG Editor and set your slicing just like you would with any sprite. VERY IMPORTANT on the bottom right corner you should tick the "Slice Mesh" option, otherwise it won't work.

    > Drag SVG into the scene or create an object with an SVGRenderer and put your SVG as vectorGraphic
    > Set Image Type to "Sliced"

    There should be a warning saying it won't work unless there is a RecTransform in the object

    > Add RectTransform component

    And now it should work, you might have to tweak the scale and RectTransform values so it fits your desired size and such; For me slicing works like a charm.
     
  20. WarpZone

    WarpZone

    Joined:
    Oct 29, 2007
    Posts:
    320
    Yup, did all that. It does not work. Looks like this in the world and in the UI:

    Update: Figured it out! Scale should not be set above 0.1 in the SVG import options! 0.1 = basically what you see below, with corners so big that your shape is all corners no matter what its dimmensions, and anything larger than 0.1 looks the same as 0.1. I think mine was set to 0.25 because this is what made it look good when placed as a sprite. Apparently Sprite and Sliced use the "scale" parameter in the import options in completely different ways.

    0.001 - 0.025 seems like a reasonable range for scale
    , based on my experience. It's nice because you can make the corners themselves larger or smaller.

     
    Last edited: Feb 3, 2017
  21. WarpZone

    WarpZone

    Joined:
    Oct 29, 2007
    Posts:
    320
    Also WTF do the dotted line box button and the capital R button do in the Rect Transform component? I toggle them on and off and it doesn't look like they do anything. No tooltip. No description in the manual. I don't even know what they're called.
     
  22. JaimeAL

    JaimeAL

    Joined:
    Dec 4, 2015
    Posts:
    21
    Just as a friendly poke to Jaroslav, if possible, we would like to know the state of the art of the plugin and its next version!

    Glad you figured the Slicing thing out!

    The Rect Transform's dottedthing is the "Blueprint mode" and the R is"Raw edit mode" >
    http://answers.unity3d.com/questions/984328/what-do-the-dotted-square-button-and-r-button-on-a.html
     
    Last edited: Feb 6, 2017
  23. qwetdgxfbgxbvxcn

    qwetdgxfbgxbvxcn

    Joined:
    Jul 19, 2013
    Posts:
    3
    The circle cannot be scaled correctly , maybe because the mesh generated cannot change and scale.So it always looks like a finite polygon.

    So what can I do to show the correct and scaled circle?


    This is my snapshot
    sadan.png




    My svg file is :

    <?xml version="1.0" encoding="utf-8"?>
    <!-- Generator: Adobe Illustrator 21.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
    <svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
    viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve">
    <style type="text/css">
    .st0{fill:none;stroke:#000000;stroke-miterlimit:10;}
    </style>
    <circle class="st0" cx="25" cy="25" r="23.5"/>
    <circle class="st0" cx="25" cy="25" r="17.5"/>
    <line class="st0" x1="25.5" y1="42.5" x2="35.5" y2="11.5"/>
    <line class="st0" x1="15.5" y1="10.5" x2="25.5" y2="42.5"/>
    <line class="st0" x1="41.5" y1="30.5" x2="15.5" y2="10.5"/>
    <line class="st0" x1="8.5" y1="30.5" x2="41.5" y2="30.5"/>
    <line class="st0" x1="35.5" y1="11.5" x2="8.5" y2="30.5"/>
    </svg>
     
  24. omobono

    omobono

    Joined:
    Dec 7, 2015
    Posts:
    2
    Hi @Jaroslav-Stehlik - sorry to hear you haven't been well.
    I am using your SVG importer in my project and trying to publish a Unity project for the Hololens and getting build errors when I try to build the VS project that is then loaded onto the Hololens. All errors seem to be related to reading and writing files. Any ideas?

    Please see errors below:

    Assets\SVG Importer\Plugins\Core\Implementation\XML Parser\SmallXmlParser.cs(106,26): error CS0117: 'char' does not contain a definition for 'GetUnicodeCategory'

    Assets\SVG Importer\Plugins\Triangle\IO\FileReader.cs(166,59): error CS1503: Argument 1: cannot convert from 'string' to 'System.IO.Stream'

    Assets\SVG Importer\Plugins\Triangle\IO\FileWriter.cs(42,59): error CS1503: Argument 1: cannot convert from 'string' to 'System.IO.Stream'

    Assets\SVG Importer\Plugins\Triangle\IO\FileWriter.cs(360,59): error CS1503: Argument 1: cannot convert from 'string' to 'System.IO.Stream'

    and many others but all similar...

    Any ideas on how to fix it I am happy to have a go at it and post any fixes. I need this to work for a project ASAP so please reply when you can.
     
    Last edited: Feb 7, 2017
  25. danilom1111

    danilom1111

    Joined:
    Mar 11, 2016
    Posts:
    3
    Hello @Jaroslav-Stehlik , is it somehow possible to generate CCGradient and assign it to SVGRenderer.vectorGraphics.layers[x].shapes[y].fill.gradientColors = new CCGGradient (gck,gak,false); ?
    where:
    //gck - gradientColorKeys
    //gak - gradientAlphaKeys
     
  26. asotelo94

    asotelo94

    Joined:
    Jan 26, 2013
    Posts:
    12
    First of, awesome tool. I was wondering if by any change you made an outline or glow shader optimized for the SVG assets. They are very common effect an would be awesome if they were included on the asset.
     
  27. kiupecharlie

    kiupecharlie

    Joined:
    Oct 15, 2015
    Posts:
    6
    Hi @Jaroslav-Stehlik , Hi everyone,

    we (a small game studio from France) uses SVG importer since a few month, that really makes a difference for us, and our workflow is now simpler. But it seems that since I had installed the 5.5.1 version of Unity, my SVG files are not recognized and supported, despite I have my plugin installed. Are you/anyone aware about that kind of problem ?

    Thanks !
     
  28. JaimeAL

    JaimeAL

    Joined:
    Dec 4, 2015
    Posts:
    21
    Please give more details! Are there any errors returned on the console? Is this on a specific device?

    Sometimes it might be your SVG export options (when you export them from illustrator for instance), you can check the manual for the recommended settings for SVG exporting or just mess around with different settings until you get it right.

    On Page 20 the first two posts talk about a known issue in 5.5.x about some gradient missing, just in case this is your issue (It is still a great workaround!)

    So far I have no issues with SVGs in 5.5.1f1, they export fine and no errors return from SVG (there is one that is most likely GooglePlay related, that in some devices apps break after getting through the GooglePlay filter). There are some things to be polished here and there but it works like a charm for me.
     
    Jaroslav-Stehlik likes this.
  29. kiupecharlie

    kiupecharlie

    Joined:
    Oct 15, 2015
    Posts:
    6
    Hi @JaimeAL

    And thanks for your response.

    The problem occured in my unity editor. In my Project view, the SVG assets I wanted to use were not recognized. So I couldn’t open them in the inspector to customize their import settings.

    Anyway, I posted too quick, sorry for that. I thought it may could be due to a conflict with the 5.5.1 version, because I just made the upgrade today. I just tried to delete and re-import all my SVG assets in the project, after having install SVG importer in the project (that makes sense), and they’re now recognizes with no issues.
     
  30. lmgginspace

    lmgginspace

    Joined:
    Nov 22, 2012
    Posts:
    33
    Anyway, I'd like to ask... It's SVG Importer currently being updated for full compatibility with Unity 5.5.x?
    The warnings are still a bit annoying, and when instancing an SVG in the scene at first there are still a few rendering problems until the material is tweaked manually (I think it's because it's not updated for 5.5x).

    For the rest, it works like a charm. My team needs this asset for a big project, and i'd like to be completely sure it won't give issues in the future.
     
  31. IIporpammep

    IIporpammep

    Joined:
    Aug 16, 2015
    Posts:
    29
    Hello, I didn't find if importer support transforms, could you show me how my svg would look in Unity?
    Code (CSharp):
    1. <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    2. <!-- Created with Inkscape (http://www.inkscape.org/) -->
    3.  
    4. <svg
    5.    xmlns:dc="http://purl.org/dc/elements/1.1/"
    6.    xmlns:cc="http://creativecommons.org/ns#"
    7.    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    8.    xmlns:svg="http://www.w3.org/2000/svg"
    9.    xmlns="http://www.w3.org/2000/svg"
    10.    xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
    11.    xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
    12.    width="210mm"
    13.    height="297mm"
    14.    viewBox="0 0 744.09448819 1052.3622047"
    15.    id="svg2"
    16.    version="1.1"
    17.    inkscape:version="0.91 r13725"
    18.    sodipodi:docname="WeaponItemBulletsTriple.svg">
    19.   <defs
    20.      id="defs4" />
    21.   <sodipodi:namedview
    22.      id="base"
    23.      pagecolor="#000000"
    24.      bordercolor="#666666"
    25.      borderopacity="1.0"
    26.      inkscape:pageopacity="1"
    27.      inkscape:pageshadow="2"
    28.      inkscape:zoom="0.98994949"
    29.      inkscape:cx="232.34194"
    30.      inkscape:cy="543.51978"
    31.      inkscape:document-units="px"
    32.      inkscape:current-layer="layer1"
    33.      showgrid="false"
    34.      inkscape:window-width="1920"
    35.      inkscape:window-height="1003"
    36.      inkscape:window-x="-9"
    37.      inkscape:window-y="-9"
    38.      inkscape:window-maximized="1" />
    39.   <metadata
    40.      id="metadata7">
    41.     <rdf:RDF>
    42.       <cc:Work
    43.          rdf:about="">
    44.         <dc:format>image/svg+xml</dc:format>
    45.         <dc:type
    46.            rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
    47.         <dc:title></dc:title>
    48.       </cc:Work>
    49.     </rdf:RDF>
    50.   </metadata>
    51.   <g
    52.      inkscape:label="Layer 1"
    53.      inkscape:groupmode="layer"
    54.      id="layer1">
    55.     <g
    56.        id="g4148">
    57.       <circle
    58.          r="224.28572"
    59.          cy="522.36218"
    60.          cx="342.85715"
    61.          id="path4684"
    62.          style="fill:none;fill-opacity:0;fill-rule:nonzero;stroke:#ffffff;stroke-width:10;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
    63.       <path
    64.          inkscape:connector-curvature="0"
    65.          id="path4686"
    66.          d="M 202.85714,505.93363 230,578.79077 267.14286,535.93363 Z"
    67.          style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
    68.       <path
    69.          inkscape:connector-curvature="0"
    70.          id="path4686-0"
    71.          d="m 327.14286,376.64792 27.14286,72.85714 37.14286,-42.85714 z"
    72.          style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
    73.       <path
    74.          inkscape:connector-curvature="0"
    75.          id="path4686-6"
    76.          d="m 263.57143,435.93364 27.14286,72.85714 37.14286,-42.85714 z"
    77.          style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
    78.       <path
    79.          d="m -218.5651,507.58069 a 12.586069,173.87549 0 0 1 -6.31618,150.76472 12.586069,173.87549 0 0 1 -12.60912,-0.55442 12.586069,173.87549 0 0 1 -6.24658,-151.31709 l 12.58581,1.10679 z"
    80.          sodipodi:end="3.1479581"
    81.          sodipodi:start="0"
    82.          sodipodi:ry="173.87549"
    83.          sodipodi:rx="12.586069"
    84.          sodipodi:cy="507.58069"
    85.          sodipodi:cx="-231.15117"
    86.          sodipodi:type="arc"
    87.          transform="matrix(0.55452582,-0.83216652,0.71636693,0.69772374,0,0)"
    88.          id="path4713"
    89.          style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:5.26485491;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
    90.       <path
    91.          d="m -122.40954,528.37537 a 12.586069,173.87549 0 0 1 -6.31617,150.76471 12.586069,173.87549 0 0 1 -12.60913,-0.55441 12.586069,173.87549 0 0 1 -6.24658,-151.31709 l 12.58581,1.10679 z"
    92.          sodipodi:end="3.1479581"
    93.          sodipodi:start="0"
    94.          sodipodi:ry="173.87549"
    95.          sodipodi:rx="12.586069"
    96.          sodipodi:cy="528.37537"
    97.          sodipodi:cx="-134.99561"
    98.          sodipodi:type="arc"
    99.          transform="matrix(0.55452582,-0.83216652,0.71636693,0.69772374,0,0)"
    100.          id="path4713-4"
    101.          style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:5.26485491;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
    102.       <path
    103.          d="m -33.099325,551.9718 a 12.586069,173.87549 0 0 1 -6.316176,150.76472 12.586069,173.87549 0 0 1 -12.609126,-0.55441 12.586069,173.87549 0 0 1 -6.246581,-151.3171 l 12.585814,1.10679 z"
    104.          sodipodi:end="3.1479581"
    105.          sodipodi:start="0"
    106.          sodipodi:ry="173.87549"
    107.          sodipodi:rx="12.586069"
    108.          sodipodi:cy="551.9718"
    109.          sodipodi:cx="-45.685394"
    110.          sodipodi:type="arc"
    111.          transform="matrix(0.55452582,-0.83216652,0.71636693,0.69772374,0,0)"
    112.          id="path4713-3"
    113.          style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:5.26485491;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
    114.     </g>
    115.   </g>
    116. </svg>
    117.  
     
  32. danilom1111

    danilom1111

    Joined:
    Mar 11, 2016
    Posts:
    3
    This is what i got after importing your svg:

     
  33. IIporpammep

    IIporpammep

    Joined:
    Aug 16, 2015
    Posts:
    29
    @danilom1111 Thank you for the help, in inkscape my svg look a little bit different.

     
  34. rarebyte

    rarebyte

    Joined:
    Sep 26, 2015
    Posts:
    10
    Bumping this. Any chance on an update that allows to compile error-free when using Unity 5.5+?
     
  35. essessr

    essessr

    Joined:
    Jul 3, 2015
    Posts:
    1
    Hi SVG Users,
    Does this package support multi-object import from a single SVG? Want to import all shapes from SVG as a group.
    Use case: would like to create the map in illustrator and import it to unity but we should have the control over individual objects in the SVG. Is it possible?
     
  36. eepromm99

    eepromm99

    Joined:
    Dec 16, 2013
    Posts:
    4
    Does anyone know if the ability to apply a texture to an svgimporter mesh has been implemented? I was under the impression that this was a capability it had when I purchased it, but, I haven't been able to get it working. i.e. If I import a simple shape in svg like a circle and apply a material to it the texture on the material is not shown, only the color. I have tried the SolidColorTexOverlayAlphaBlended shader and it has no effect.
     
    Last edited: Feb 25, 2017
  37. eepromm99

    eepromm99

    Joined:
    Dec 16, 2013
    Posts:
    4
    It appears this asset is no longer supported. It's been about a week since I sent an email and no responses here. In addition to the issue with applying a texture there are also errors popping up related to shaders on unity 5.5 and a load of simple svgs that don't import due to "invalid syntax". Apparently I should have looked at these forums to see the months of unanswered questions before purchase. Feel like if that's the case, some feedback on the asset purchase page is needed to give some warning.
     
  38. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    922
    You are not alone, many pple bought this expensive plugin and now they dont know what to do. Because doing anything for long term cant be done in it.
    my problem of a showing crisp circle never solved and i left hoping that it'd ever get solved again
     
  39. JaimeAL

    JaimeAL

    Joined:
    Dec 4, 2015
    Posts:
    21
    I am not going to deny that support has been close to non-existent this month, because that is a fact.

    @Jaroslav-Stehlik (the author) have had some health issues in the past and maybe he is still recovering. A new version seems to be in the way (however I cannot confirm anything) , and it would be great that Jaroslav would show up around to keep us all updated, I know.

    So far we have been working with SVG Importer in our project for about a year and never really had major issues. (in fact, most major issues are when changing Unity's versions)

    I do share the panic of all of the sudden a plugin so vital to our project could die, and we'd have to spend more money than the plugin cost into replacing and fixing everything (or simply say goodbye to the project and call it a huge failure) Yet this plugin has helped us a lot during development! And still works for us!

    If you do look at the forums, Tacoiluminati at the top of Page 20 has a workaround for the Shaders issues. I am not aware of the "invalid syntax" error, never found it but feel fee to throw more details of the error here too. Some exporting SVG settings do not work when importing, in the documentation you have some guide in which ones you should use; And sometimes if there are other errors unrelated to SVG Importer in your console it might stop SVG Importer from importing SVGs at all.

    Crisp circles sounds like you need to apply antialising to the SVG (however now antialising is global, in the SVG Importer settings, so be careful)
     
    Last edited: Feb 27, 2017
    shaneparsons likes this.
  40. eepromm99

    eepromm99

    Joined:
    Dec 16, 2013
    Posts:
    4
    "Health issues" so severe that an email requesting a simple answer can't be replied to even after weeks? Or a simple post to a forum over the course of months? That screams bs to me. Either that or the author is, unfortunately, so ill that the asset is no longer supported anyway, effectively the same thing. If they're not going to provide support then they need to STOP SELLING THE ASSET or lower the price dramatically and indicate no support. I JUST bought this thing a couple weeks ago based on the advertising on the sales page that it supports the latest unity.

    I do thank you for your reply though.





     
    Last edited: Feb 27, 2017
  41. Immobile-Games

    Immobile-Games

    Joined:
    Jul 10, 2015
    Posts:
    1
    I just purchased this asset and have a serious problem with some layers being black. Has anyone else have this problem and if so, is there a solution for it? I'll file a refund if there's not an easy solution for it.
     
    mikolajewskip likes this.
  42. m7g2

    m7g2

    Joined:
    Sep 23, 2012
    Posts:
    4
    tessellation and movra like this.
  43. JaimeAL

    JaimeAL

    Joined:
    Dec 4, 2015
    Posts:
    21
    Please give more information, a screenshot of how it should work and how its not working! Otherwise is hard to tell.

    In the plugin documentation you have got some guidelines in how to export SVGs, sometimes some settings do not get imported properly (for instance we cannot pass text through an SVG, we have to vectorize it)

    Unfortunately support has been non-existent lately, but also try to email Jaroslav (the author) just in case with as much info as possible!
     
  44. tacoilluminati

    tacoilluminati

    Joined:
    Oct 30, 2015
    Posts:
    6
    Hey y'all, we're using big squares with opacity: 0 included in our assets so we can have varying sizes all match up with a common pivot point (basically enforcing the size of the canvas among our exported (and trimmed) assets), but importing a SVG with a transparent piece as "opaque" will cause an error.

    If you add
    Code (CSharp):
    1. if (nodes[k] >= layers[i].shapes.Length) continue;
    to line 80 of SVGMesh.cs, the error goes away and nothing seems to break with the import. This hasn't been heavily tested but I thought it could be useful for some people.

    The area of code finally looks like:
    Code (CSharp):
    1. for(int k = 0; k < nodesLength; k++)
    2. {
    3.     if (nodes[k] >= layers[i].shapes.Length) continue; //Taco Edit: This was causing errors
    4.     if((int)layers[i].shapes[nodes[k]].depth > highestDepth)
    5.     {
    6.         highestDepth = (int)layers[i].shapes[nodes[k]].depth;
    7.         highestLayer = nodes[k];
    8.     }
    9. }
     
    onceabird likes this.
  45. GaryK

    GaryK

    Joined:
    Mar 12, 2017
    Posts:
    1
    I am considering purchasing SVG Importer and have a question that current users might be able to help with.

    There's a warning about Adobe Illustrator having a bug when saving to SVG (hence the author suggests you always keep your graphics in .AI or other formats until the final export). I have vector graphics from Shutterstock that are in EPS, and you don't get any other version, does anyone know if Shutterstock EPS files, converted through Inkscape to SVG will work well or have people experienced problems?

    I'm holding off until Unity 5.5 is fully supported, but the limited control I have over the source graphics is a concern.

    Thanks in advance.
     
  46. JaimeAL

    JaimeAL

    Joined:
    Dec 4, 2015
    Posts:
    21
    Hello! We have found an exception that breaks all our SVGs in some Android devices, we suspect that it is a Unity+GooglePlay incorporation since exporting directly from Unity into the device works perfectly, but after going through the Play Store it breaks in some devices.

    We have tested in a bunch of versions but so far it seems to occur on the older versions (4.4.2), the error is as follows:

    "Cannot Load SVG Importer Settings! Please Move SVG Importer Settings in to Resource folder.
    NullReferenceException: Object reference not set to an instance of an object

    SVGImporter.SVGImporterSettings.UpdateAntialising( ..).)
    SVGImporter.SVGAtlas.OnAtlasRender(..)
    SVGImporter.Utils.SVGCamera.OnPreRender()"


    Any suggestions? Has anyone encountered the same issue?

    Moving SVG Importer to the Resources folder didnt work (but now I am trying to move just the settings alone, however I still do not understand it, since it works but in some devices it doesnt??)
     
  47. tessellation

    tessellation

    Joined:
    Aug 11, 2015
    Posts:
    102
    I just got this error when I closed the Unity Editor, deleted the Library folder, and reopened Unity. It caused the Editor to reimport everything and then it reports multiples of these errors in the Console window. Perhaps it's prematurely trying to read the settings before the engine has fully initialized?
     
  48. onatangent

    onatangent

    Joined:
    Nov 12, 2016
    Posts:
    10
    This has been asked back in October (here), but I was unable to find an answer to it. I'm also getting an error when Unity compiles the UnitySVG.cginc file when using Unity on Mac.

    The exact error is:
    Shader error in 'SVG Importer/Standard SVG': invalid subscript 'posWorld' 'FragmentSetup': no matching 5 parameter function at Assets/SVG Importer/Plugins/Shaders/Standard/UnitySVG.cginc(118) (on glcore)​

    Compiling Vertex program with DIRECTIONAL LIGHTMAP_OFF DYNAMICLIGHTMAP_OFF _ALPHABLEND_ON
    Platform defines: UNITY_NO_SCREENSPACE_SHADOWS UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF2 SHADER_API_DESKTOP UNITY_HARDWARE_TIER3​

    What is the fix for this?

    Edit: I went in and modified the UnityStandardCore.cginc file (where FRAGMENT_SETUP is defined) and made a quick mod to change "i.posWorld" to "half3(0,0,0)". I then modified the UnitySVG.cginc and saved to force a recompile. The compilation was successful. I then changed the UnityStandardCore.cginc back to its original state and then reverted the UnitySVG.cginc to its original state, and Unity threw no compilation errors. Strange! Not sure what's going on here, but I seemingly have fixed my problem.
     
    Last edited: Mar 26, 2017
  49. lmgginspace

    lmgginspace

    Joined:
    Nov 22, 2012
    Posts:
    33
    Totally agree, I'm sorry the author has severe health issues, but I'm sure by the forum there are a lot of people that could help, specially those that have "co-worked" with the author since the asset creation. But they simply wash their hands of the matter.
    This message is for new customers. If you need to import SVG as meshes, one has to go with a somewhat expensive, partially-working, fully-unsuporrted asset. And no alternatives.
     
    seidensj likes this.
  50. tessellation

    tessellation

    Joined:
    Aug 11, 2015
    Posts:
    102
    There is a patch fix for this (I can confirm works with Unity 5.5.2) posted a few pages back.