Class SVGImage
A UI image that holds SVG content.
Inherited Members
UnityEngine.UI.MaskableGraphic.OnValidate()
UnityEngine.UI.MaskableGraphic.UnityEngine.UI.IClippable.get_gameObject()
UnityEngine.UI.Graphic.OnRebuildRequested()
UnityEngine.UI.Graphic.Reset()
UnityEngine.UI.Graphic.UnityEngine.UI.ICanvasElement.get_transform()
Namespace: Unity.VectorGraphics
Syntax
[AddComponentMenu("UI/SVG Image", 11)]
[MovedFrom("")]
[RequireComponent(typeof(CanvasRenderer))]
public class SVGImage : MaskableGraphic, ICanvasElement, IClippable, IMaskable, IMaterialModifier
Properties
mainTexture
The main texture of the SVG image. This will be a white texture for textureless images.
Declaration
public override Texture mainTexture { get; }
Property Value
| Type | Description |
|---|---|
| Texture |
Overrides
preserveAspect
If true, preserves the aspect ratio of the SVG image.
Declaration
public bool preserveAspect { get; set; }
Property Value
| Type | Description |
|---|---|
| Boolean |
sprite
The sprite that is used to render this image.
Declaration
public Sprite sprite { get; set; }
Property Value
| Type | Description |
|---|---|
| Sprite |
Remarks
This returns the source Sprite of an Image. This Sprite can also be viewed and changed in the Inspector as part of an Image component. This can also be used to change the Sprite using a script.
Methods
OnPopulateMesh(VertexHelper)
Populates the mesh
Declaration
protected override void OnPopulateMesh(VertexHelper toFill)
Parameters
| Type | Name | Description |
|---|---|---|
| VertexHelper | toFill | The vertices to fill |