[Free] SkiaSharp for unity with skottie

SkiaSharp for Unity for free [GitHub]

SkiaSharp for Unity is a plugin that brings the power and flexibility of SkiaSharp, a 2D graphics library, to the Unity game development environment. With SkiaSharp for Unity, you can create high-quality, cross-platform 2D graphics and user interfaces for your Unity projects. This package also includes the Skottie library for working with Lottie animations.

SkiaSharp is a .NET binding to the Skia library, which is used by popular platforms such as Google Chrome, Android, and Flutter. By integrating SkiaSharp into Unity, you can leverage its extensive set of APIs for rendering vector graphics, text, and images.

skottie inside unity gif (lottie files):
https://s11.gifyu.com/images/SQOEX.gif

  • HarfBuzz support: The integration of HarfBuzz enhances text rendering in SkiaSharp, offering benefits such as native fonts, emoji rendering, and RTL language support. This makes SkiaSharp for Unity an excellent choice for projects that require advanced text rendering capabilities.

https://github.com/ammariqais/SkiaForUnity/assets/62248657/ac1a8c35-bb24-4b64-ac3e-85a5b06ed276

Features

  • High-performance graphics: SkiaSharp for Unity utilizes Skia’s hardware-accelerated rendering capabilities to deliver fast and smooth graphics performance.

  • Cross-platform support: SkiaSharp supports multiple platforms, including Windows, macOS, iOS, Android, allowing you to create graphics that work seamlessly across different devices.

  • Extensive API: SkiaSharp provides a rich set of APIs for drawing paths, shapes, text, and images, enabling you to create visually stunning graphics and user interfaces.

  • Custom shaders: With SkiaSharp for Unity, you can write custom shaders using the Skia graphics API, allowing you to create unique visual effects and stylized graphics.

  • Lottie animations: The package includes the Skottie library, which enables you to import and play Lottie animations in your Unity projects.

  • Integration with Unity: SkiaSharp for Unity integrates seamlessly with the Unity Editor, providing a familiar development environment for working with Skia graphics and Lottie animations in your Unity projects.

Platform supports:

  • android
  • ios
  • macOs
  • windows

download:
https://github.com/ammariqais/SkiaForUnity/

2 Likes

SkiaForUnity - New Release (v1.0.0.Pre-2)

We are excited to announce the release of SkiaForUnity v1.0.0.Pre-2! This new version brings several enhancements, bug fixes, and exciting features to enhance your experience with Skia and Unity. Whether you’re a seasoned user or just starting with SkiaForUnity, we believe this release will provide you with an even more powerful and enjoyable development environment.

Release Highlights

  1. Rendering Skottie Animation on Edit Mode in Unity: With this release, SkiaForUnity introduces the ability to render Skottie animations directly within the Unity Editor. This feature allows you to preview and fine-tune your animations without entering Play mode, streamlining your workflow and saving development time.

  2. Introducing SkottiePlayer.cs: SkiaForUnity now includes the new SkottiePlayer.cs class, which enables you to play animations with ease. This class provides functionalities such as animation playback, looping, autoplay, and playing animations with specific Lottie markers. It simplifies the integration of Skottie animations into your Unity projects and gives you greater control over the playback experience.

  3. OnAnimationFinished Delegate: To enhance your animation control, we have added the OnAnimationFinished delegate. This delegate is called when an animation reaches its end, allowing you to trigger specific actions or events based on the completion of the animation. It provides a seamless way to handle animation completion and take further actions in your application.

Changelog

New Features

  • Rendering Skottie Animation on Edit Mode in Unity: Preview and fine-tune Skottie animations within the Unity Editor.
  • SkottiePlayer.cs: Play animations, loop animations, autoplay, and play animations with specific Lottie markers using the SkottiePlayer.cs class.
  • OnAnimationFinished Delegate: Trigger actions or events when an animation reaches its end with the OnAnimationFinished delegate.

Enhancements

  • Performance optimizations for smoother Skottie animation playback.
  • Improved compatibility with various Skottie animation files.
  • Enhanced error handling and reporting for better debugging.

Bug Fixes

  • Resolved issues related to Skottie animation rendering and playback.
  • Fixed compatibility issues with specific Lottie marker configurations.
  • Addressed minor bugs reported by the community.

Watch the SkiaForUnity v1.0.0.Pre-2 Release Videos:

Editor Mode

Playing Animations

1 Like

SkiaForUnity - New Release (v1.0.0)

What’s Changed

  • [unity wnidows] fix issue multiple plugins with the same name for unity by @ammariqais in #9
  • [Skottie Player] add methods getDuration and getFps by @ammariqais in #10

Full Changelog: 1.0.0.pre-3…1.0.0

Hi,
We are developing graphics editor in unity using svg vector graphics package. We want to render text svg text.
Is this package compatible with some skiasharp extensions as GitHub - wieslawsoltes/Svg.Skia: An SVG rendering library., GitHub - toptensoftware/RichTextKit: Rich text rendering for SkiaSharp, … ?
and how to compile some skiasharp extended package ?

Best regards

Interesting!
One thing that confuses me though: On the github, the Get Started section explicitly aims at iOS and isn’t general. Does that imply anything for other platforms?

Don’t run on Mac M1 due to code signing

what the error?

new update availabe

fixed issue Doesn’t work for Windows builds #15

What’s Changed

Full Changelog: 1.0.1…1.0.2

Installation
Package Manager

  • Open your Unity project and navigate to Windows> Package Manager.
  • Click the + button in the top-left corner and select Add package from git URL
  • Enter the following URL and click Add

Thank you for skiasharp for unity
After change security & policy (allow to run that bundle), and it work

Does anyone have working examples how to proper use Skia?
I can’t set generated image to Unity Texture.
More likely I’m doing something wrong but Unity keeps crashing when I try to access Handle property of SKPixmap of SKImage.

can you post the code

version 2.0.0 released :),

Harfbuzz now supports for unity,

Why Use HarfBuzz and Skia
Advantages of HarfBuzz
Complex Text Layout: HarfBuzz is a leading open-source text shaping engine capable of handling complex scripts and languages. It provides excellent support for shaping and rendering text in various writing systems.

Multilingual Support: HarfBuzz supports a wide range of scripts and languages, making it an ideal choice for developers aiming to reach a global audience.

Standard Compliance: HarfBuzz adheres to established international text layout standards, ensuring compatibility with various platforms and rendering engines.

Benefits
Improved Text Quality

Integrating HarfBuzz and Skia into Unity will result in significantly improved text rendering quality, especially for complex scripts, languages, RTL (Right-to-Left) languages, and emojis. This is crucial for creating more engaging and accessible applications.

Enhanced Multilingual Support

With HarfBuzz, Unity will be able to support a broader range of languages and writing systems, including RTL languages, making it easier to develop.

Cross-Platform Compatibility

Skia’s cross-platform compatibility ensures that Unity applications will look and perform consistently across various operating systems. tested on (ios,android,macOs,windows)

video:
https://github.com/ammariqais/SkiaForUnity/assets/62248657/ac1a8c35-bb24-4b64-ac3e-85a5b06ed276

good news version 2 released!, this update support HarfBuzz and RichTextKit!

What’s Changed

Supports custom fonts and images inside Lottie files!!

Full Changelog: 2.1.2…3.0.0-pre.3

2 Likes

Updates support SVG’s inside unity

We can use SVGLoader to show svg image. The font look different, how to fix ?

There seem to be problems importing it to Unity 6.3 by git URL - you have to use the doc URL SkiaForUnity/SkiaUnity/Assets/SkiaSharp at main · ammariqais/SkiaForUnity · GitHub (now works)

Does this add anything (apart from some more libraries) to Skia with Unity that one can not do by simply importing Skia yourself?

v4.0 Released!

video

HB TextBlock

  • Vertical alignment — Top, Middle, Bottom
  • Text direction — LTR, RTL, Auto
  • Font weight — 100 (Thin) to 900 (Black)
  • Font variant — Normal, SuperScript, SubScript
  • Rich text — <b> <i> <u> <s> <sup> <sub> <size=N> <color=#HEX> <color=name>
  • Fallback fonts — multiple HBFontData assets for multi-language support
  • Paragraph spacing — configurable space between paragraphs
  • Padding — Left, Top, Right, Bottom text area padding
  • Link detection — automatic URL rendering with click callbacks
  • Events — onTextChanged, onLinkClicked
  • ILayoutElement integration for Unity layout system
  • TMP-style Inspector — section headers, B/I/U/S toggle strip, alignment buttons, collapsible sections, gradient editor, text info panel, live preview, tooltips on every field

HB InputField (New)

Full-featured input field built on HB_TEXTBlock, similar to TMP_InputField.

  • Content types — Standard, Integer, Decimal, Alphanumeric, Name, Email, Password
  • Line types — SingleLine, MultiLine
  • Text settings — font, font size, color, bold, italic, alignment, rich text
  • Placeholder — configurable text and color
  • Auto-resize — multiline fields grow height to fit content (min/max bounds)
  • Text scrolling — horizontal for single-line, vertical for multiline
  • Caret — configurable color, blink rate, width, or hide completely
  • Selection — click, double-click (word), triple-click (all), Shift+arrows, Ctrl+A
  • Clipboard — Ctrl+C, Ctrl+V, Ctrl+X
  • Navigation — arrow keys, Ctrl+arrows (word jump), Home, End, Tab/Shift+Tab
  • Read-only mode — custom background and font color
  • Focus highlight — optional background color change
  • Mobile support — hide native input overlay on iOS/Android
  • Character limit and password masking
  • Events — onValueChanged, onSubmit, onEndEdit, onFocus, onUnfocus

HB Text Animator

  • Sequential multi-step animations on any HB_TEXTBlock
  • Effects — Typewriter, Fade, Color Lerp, Scale, Slide, Shake, Gradient Angle, Outline Pulse, Shadow Animate, Font Size, Letter Spacing
  • Per-step duration, delay, and ease curve
  • Loop support, editor preview, onStepComplete/onComplete events
1 Like