Skia For Unity with lottie animations, harfbuzz, svg supports
Skia For Unity with lottie animations, harfbuzz, svg supports
SkiaSharp for Unity is a powerful plugin that leverages the SkiaSharp 2D graphics library to enhance Unity game development. With the added advantage of HarfBuzz support, this plugin allows you to create high-quality, cross-platform 2D graphics and user interfaces for your Unity projects. HarfBuzz support enables better text rendering, including advanced features such as native fonts, emoji support, and right-to-left (RTL) language rendering.
SkiaSharp is a .NET binding to the Skia library, which is utilized by popular platforms like Google Chrome, Android, and Flutter. By integrating SkiaSharp into Unity, you gain access to a wide range of APIs for rendering vector graphics, text, and images. The inclusion of HarfBuzz further improves text rendering, making it ideal for internationalization and multilingual projects.
Draw rectangles, rounded rects, circles, and ellipses directly on Unity Canvas. Supports solid colors, linear/radial/sweep gradients, image fills, strokes (solid, dashed, gradient), drop shadows, and inner shadows — all configurable from the inspector with no code required.
Advanced text rendering powered by HarfBuzz and SkiaSharp. Supports native system fonts, emoji, RTL/bidirectional text, rich text tags (, , , , etc.), fallback fonts for multi-language, paragraph spacing, padding, link detection, and vertical alignment. Includes a full-featured input field with selection, clipboard, auto-resize, and mobile support.
Import and play Lottie JSON animations using the Skottie library. Control playback with play, pause, stop, and seek. Supports animation markers for state-based playback and looping.
Render scalable vector graphics using SVG.Skia. SVGs scale to any resolution without losing quality, making them ideal for icons, illustrations, and resolution-independent UI elements across all platforms.
Bake any SkiaGraphic or HB TextBlock in the editor to a Sprite PNG and automatically add it to a shared SpriteAtlas. Baked elements have zero SkiaSharp runtime cost and batch draw calls efficiently (20 baked elements can render in 1–2 draw calls). Supports nine-slice for solid-fill shapes. One-click unbake restores live rendering.
Dirty-flag rendering coalesces multiple property changes into a single render per frame. SKSurface and SKTypeface are cached and reused. Gradient objects are hash-checked to avoid unnecessary recreation. Layout rebuilds only trigger when size actually changes.
Windows, macOS, Linux, iOS, and Android. Integrates with Unity Canvas UI system including layout groups, masks, and draw call batching.
https://github.com/user-attachments/assets/a28f7218-6a5a-46c6-9a2b-f21c516a9a1e
A Canvas UI component for rendering vector shapes with zero code.
GameObject > Skia UI (Canvas) > Skia GraphicAdvanced text rendering component powered by HarfBuzz and SkiaSharp.
``Full-featured input field built on HB TextBlock, similar to TMP_InputField.
Sequential multi-step animations on any HB TextBlock.
Render any SkiaGraphic or HB TextBlock in the editor, save as a Sprite PNG, and batch via a shared SpriteAtlas — zero SkiaSharp cost at runtime.
SpriteAtlas for draw call batching (20 baked elements → 1-2 draw calls)LayoutRebuilder.MarkLayoutForRebuild only called when size actually changeshttps://github.com/ammariqais/SkiaForUnity/assets/62248657/ac1a8c35-bb24-4b64-ac3e-85a5b06ed276
https://github.com/ammariqais/SkiaForUnity/assets/62248657/ccf71cd1-17ae-4442-b42f-4d3d067849f1
https://github.com/ammariqais/SkiaForUnity/assets/62248657/cc7a5d56-48e7-4e28-8e18-b8e8ec776eab
To get started with SkiaSharp for Unity, follow these steps:
Package Manager
Windows> Package Manager.+ button in the top-left corner and select Add package from git URLAddhttps://github.com/ammariqais/SkiaForUnity.git?path=SkiaUnity/Assets/SkiaSharp
Import the SkiaSharp package into your Unity project.
if you're building your game for iOS. This step is necessary to have the library work on iOS
4a. In Unity, go to Edit > Project Settings > Player and select the iOS platform.
4b. Scroll down to the Other Settings section and locate the Scripting Define Symbols field.
4c. Add __UNIFIED__ and __IOS__ to the Scripting Define Symbols.
Create a new script or modify an existing script to leverage the SkiaSharp API for drawing graphics and the Skottie API for playing Lottie animations.
Contributions to SkiaSharp for Unity are welcome! If you encounter any issues, have suggestions for improvements, or would like to contribute code, please feel free to open an issue or submit a pull request on the GitHub repository.
SkiaSharp for Unity is licensed under the MIT License. Please refer to the LICENSE file for more information.
If you have any questions, need assistance, or want to join a community of developers using SkiaSharp for Unity, you can:
Visit the SkiaSharp for Unity GitHub Discussions page to engage in discussions and ask questions.
Open an issue on the GitHub repository if you encounter any bugs or problems.
SkiaSharp for Unity is built on top of the amazing SkiaSharp library and includes the Skottie library for Lottie animations. We would like to express our gratitude to the SkiaSharp and Skottie communities for their hard work and dedication in developing and maintaining these powerful libraries.
SkiaSharp for Unity is developed and maintained by Qais Ammari.
No open issues yet, or sync has not completed.