Assets > Import New Asset
from the menu bar. When imported, you can instantiate the resulting assets in the Hierarchy View or the Scene View.Property | Function |
---|---|
Pixels Per Unit | Number of SVG units that correspond to 1 scene unit. |
Tessellation Step Distance | Distance at which Unity generates triangles when tessellating the paths. A smaller step distance will result in smoother curves at the expense of more triangles. |
Gradient Resolution | Texture size used to store gradients. |
Pivot | Location of the pivot for the generated sprite. This follows the same convention as regular sprites, with an additional SVG Origin pivot value. When using SVG Origin, the pivot is the (0,0) position of the SVG document. |
Property | Function |
---|---|
Step Distance | Distance at which the importer generates vertices along the paths. Lower values result in a more dense tessellation. |
Sampling Steps | Number of samples the importer evaluates on paths. More samples may result in more precise curves, especially when the curves have sharp corners. |
Max Cord Deviation | Distance on the cord to a straight line between two points after which the importer generates more tessellation. |
Max Tangent Angle | Maximum tangent angle (in degrees) after which the importer generates tessellation. |
Scene
class, which stores a graph of vector objects. Its Root
property is an instance of SceneNode
, which contains a list of drawable items, a list of child nodes, a transform and a clipper (see clipping).BezierContour
. A BezierContour
contains a BezierPathSegment
array and a flag that indicates whether the contour is closed or not.BezierPathSegment
array defines a chain of cubic Bézier curves. The above segment specifies only the first point, P0
, and two control points, P1
and P2
. The Path
class uses the P0
value of the next segment in the array to complete the curve. So, you will always need at least two segments to define a valid BezierContour
. Using this approach allows the chaining of multiple segments and guarantees the continuity of the curve. For example, consider this path:BezierContour
with Closed = true
, the contour's last path segment will be connected to the first path segment, and the last path segment's P1
and P2
values will be used as control points.BezierContour
, but they also provide a filling method:IFill
interface:SolidFill
for a simple colored fillingsTextureFill
for a texture fillingsGradientFill
for linear or radial gradient fillingsLinear
or Radial
type and a series of colors/percentage pairs, called stops:GradientFill
instance to generate it:FillMode.NonZero
determines which points are inside a shape by intersecting the contour segments with an horizontal line. The direction of the contour determines whether the points are inside or outside the shape:FillMode.OddEven
also works by intersecting the segments with an horizontal line. Points inside the shape occur when an even number of segments is crossed, and points outside the shape occur when an odd number of segments is crossed:SceneNode
class has a clipper member which will clip the content of the node.VectorUtils
method:TesselationOptions
are similar to the advanced importer settings:maxTanAngleDeviation
is specified in radians.maxCordDeviation
constraint, set it to float.MaxValue
. To disable the maxTanAngleDeviation
constraint, set it to Mathf.PI/2.0f
. Disabling the constraints will make the tessellation faster, but may generate more vertices.Geometry
objects contains all the vertices and accompanying information required to render the scene properly.VectorUtils
class:GenerateAtlas
method is an expensive operation, so cache the resulting Texture2D object whenever possible. You only need to regenerate the atlas when a texture or gradient changes inside the scene.FillUVs
method, which is cheap.Drawing a tessellated sceneYou can render the geometry in several ways. For example:Mesh
assetSprite
assetVectorUtils
method:VectorUtils
method:Texture2D
, use the following VectorUtils
method:GL
commands, use the RenderSprite
method in the VectorUtils
class to draw the sprite into a unit square (a box between 0 and 1 in both X and Y directions):Date | Reason |
---|---|
Sept 24, 2018 | Matches Vector Graphics 1.0.0-preview.19 |
May 2, 2018 | Matches Vector Graphics 1.0.0-preview.7 |
Mar 20, 2018 | Updated public APIs documentation. Matches Vector Graphics version 1.0.3-experimental. |
Feb 01, 2018 | Document created. Matches Vector Graphics version 1.0.2-experimental. |