Class SVGImporter
The SVG importer class.
Implements
Inherited Members
Namespace: Unity.VectorGraphics.Editor
Assembly: Unity.VectorGraphics.Editor.dll
Syntax
[Serializable]
[ScriptedImporter(6, "svg")]
public class SVGImporter : ScriptedImporter, ISpriteEditorDataProvider
Properties
AdvancedMode
Use advanced settings.
Declaration
public bool AdvancedMode { get; set; }
Property Value
Type | Description |
---|---|
bool |
Alignment
The SVG sprite alignement.
Declaration
public VectorUtils.Alignment Alignment { get; set; }
Property Value
Type | Description |
---|---|
VectorUtils.Alignment |
CustomPivot
The custom pivot, when alignement is "Custom".
Declaration
public Vector2 CustomPivot { get; set; }
Property Value
Type | Description |
---|---|
Vector2 |
FilterMode
The filter mode of the texture (only used when importing to a texture).
Declaration
public FilterMode FilterMode { get; set; }
Property Value
Type | Description |
---|---|
FilterMode |
GeneratePhysicsShape
Automaticallly generates a physics shape.
Declaration
public bool GeneratePhysicsShape { get; set; }
Property Value
Type | Description |
---|---|
bool |
GradientResolution
Maximum resolution for gradient texture.
Declaration
public ushort GradientResolution { get; set; }
Property Value
Type | Description |
---|---|
ushort |
KeepTextureAspectRatio
The size of the texture (only used when importing to a texture).
Declaration
public bool KeepTextureAspectRatio { get; set; }
Property Value
Type | Description |
---|---|
bool |
MaxCordDeviation
Distance on the cord to a straight line between two points after which more tessellation will be generated.
Declaration
public float MaxCordDeviation { get; set; }
Property Value
Type | Description |
---|---|
float |
MaxCordDeviationEnabled
Enables the "max coord deviation" constraint.
Declaration
public bool MaxCordDeviationEnabled { get; set; }
Property Value
Type | Description |
---|---|
bool |
MaxTangentAngle
Max tangent angle (in degrees) after which more tessellation will be generated.
Declaration
public float MaxTangentAngle { get; set; }
Property Value
Type | Description |
---|---|
float |
MaxTangentAngleEnabled
Enables the "max tangent angle" constraint.
Declaration
public bool MaxTangentAngleEnabled { get; set; }
Property Value
Type | Description |
---|---|
bool |
PredefinedResolutionIndex
The predefined resolution used, when not in advanced mode.
Declaration
public int PredefinedResolutionIndex { get; set; }
Property Value
Type | Description |
---|---|
int |
PreserveSVGImageAspect
When importing to an SVGImage, preserves the aspect ratio of the generated sprite.
Declaration
public bool PreserveSVGImageAspect { get; set; }
Property Value
Type | Description |
---|---|
bool |
PreserveViewport
Preserves the viewport defined in the SVG document.
Declaration
[Obsolete("Use the ViewportOptions property instead")]
public bool PreserveViewport { get; set; }
Property Value
Type | Description |
---|---|
bool |
ResolutionMultiplier
An additional scale factor on the target resolution.
Declaration
public float ResolutionMultiplier { get; set; }
Property Value
Type | Description |
---|---|
float |
SampleCount
The number of samples per pixel (only used when importing to a texture).
Declaration
public int SampleCount { get; set; }
Property Value
Type | Description |
---|---|
int |
SamplingStepDistance
Number of samples evaluated on paths.
Declaration
public float SamplingStepDistance { get; set; }
Property Value
Type | Description |
---|---|
float |
StepDistance
The uniform step distance used for tessellation.
Declaration
public float StepDistance { get; set; }
Property Value
Type | Description |
---|---|
float |
SvgPixelsPerUnit
The number of pixels per Unity units.
Declaration
public float SvgPixelsPerUnit { get; set; }
Property Value
Type | Description |
---|---|
float |
SvgType
How the SVG file will be imported
Declaration
public SVGType SvgType { get; set; }
Property Value
Type | Description |
---|---|
SVGType |
TargetResolution
The target resolution on which this SVG is displayed.
Declaration
public int TargetResolution { get; set; }
Property Value
Type | Description |
---|---|
int |
TextureHeight
The height of the texture (only used when importing to a texture).
Declaration
public int TextureHeight { get; set; }
Property Value
Type | Description |
---|---|
int |
TextureSize
The size of the texture (only used when importing to a texture with "keep aspect ratio").
Declaration
public int TextureSize { get; set; }
Property Value
Type | Description |
---|---|
int |
TextureWidth
The width of the texture (only used when importing to a texture).
Declaration
public int TextureWidth { get; set; }
Property Value
Type | Description |
---|---|
int |
TexturedSpriteMeshType
For textured sprite, the mesh type
Declaration
public SpriteMeshType TexturedSpriteMeshType { get; set; }
Property Value
Type | Description |
---|---|
SpriteMeshType |
UseSVGPixelsPerUnit
Declaration
public bool UseSVGPixelsPerUnit { get; set; }
Property Value
Type | Description |
---|---|
bool |
ViewportOptions
Viewport options to use when importing the SVG document.
Declaration
public ViewportOptions ViewportOptions { get; set; }
Property Value
Type | Description |
---|---|
ViewportOptions |
WrapMode
The wrap mode of the texture (only used when importing to a texture).
Declaration
public TextureWrapMode WrapMode { get; set; }
Property Value
Type | Description |
---|---|
TextureWrapMode |
pixelsPerUnit
Returns pixels per unit of the imported SVG
Declaration
public float pixelsPerUnit { get; }
Property Value
Type | Description |
---|---|
float |
spriteImportMode
Returns the sprite import mode
Declaration
public SpriteImportMode spriteImportMode { get; }
Property Value
Type | Description |
---|---|
SpriteImportMode |
Remarks
For SVG files, the import mode is always "single"
targetObject
Returns imported sprite
Declaration
public Object targetObject { get; }
Property Value
Type | Description |
---|---|
Object |
Methods
OnImportAsset(AssetImportContext)
Imports an SVG asset
Declaration
public override void OnImportAsset(AssetImportContext ctx)
Parameters
Type | Name | Description |
---|---|---|
AssetImportContext | ctx | The asset import context of the scripted importer |