Skip to content

Commit

Permalink
Unity
Browse files Browse the repository at this point in the history
The technical preview for Unity!

Supports:
- Metal on Mac and iOS
- DX11 on Windows
- OpenGL on Windows

Features:
- Drag and drop .riv files to your Assets folder in Unity
- Preview the riv file by selecting it in Assets.
- Use [Rive.File](https://github.com/rive-app/rive/blob/f9567617cea631612ec29b98e047cbfeb597b7c3/packages/runtime_unity/public/package/Runtime/RiveFile.cs#L16) for loading Rive assets at runtime.
  - Iterate artboards
  - Load artboard by index or name
- File.loadArtboard calls return [Rive.Artboard](https://github.com/rive-app/rive/blob/f9567617cea631612ec29b98e047cbfeb597b7c3/packages/runtime_unity/public/package/Runtime/Artboard.cs#L13) objects.
  - Lists state machines
  - Load by name or index
  - Convert screen coordinates to artboard local
- Artboard.stateMachine calls load [Rive.StateMachine](https://github.com/rive-app/rive/blob/f9567617cea631612ec29b98e047cbfeb597b7c3/packages/runtime_unity/public/package/Runtime/StateMachine.cs)
  - Set pointerDown/Up/Move on StateMachine.

Upcoming Features:
- Get and set inputs on state machines.
- Get events from Artboards.
- Procedural rendering: use Rive's Renderer from C#!

Diffs=
faba3ff51 Unity (#6173)

Co-authored-by: Luigi Rosso <[email protected]>
  • Loading branch information
luigi-rosso and luigi-rosso committed Nov 13, 2023
1 parent 42159b2 commit b40558c
Show file tree
Hide file tree
Showing 117 changed files with 10,379 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .rive_head
Original file line number Diff line number Diff line change
@@ -1 +1 @@
82d664d4b98fafae7d064cc8945db101580b7d41
faba3ff515e612f2fbc8e65dff11095f9a0dbbe2
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Contributing

We love contributions! If you want to run the project locally to test out changes, run the examples,
or just see how things work under the hood, read on below.
85 changes: 85 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
![Discord badge](https://img.shields.io/discord/532365473602600965)
![Twitter handle](https://img.shields.io/twitter/follow/rive_app.svg?style=social&label=Follow)

# Rive Unity

![Rive hero image](https://cdn.rive.app/rive_logo_dark_bg.png)

A Unity runtime library for [Rive](https://rive.app). This is currently a **technical preview** for Mac and Windows installs of Unity. We're hoping to gather feedback about the API and feature-set as we expand platform support.

### Rendering Support

Currently supported platforms and backends include:

- Metal on Mac
- Metal on iOS
- D3D11 on Windows
- OpenGL on Windows

Planned support for:

- D3D12
- WebGL
- Vulkan

### Feature Support

The rive-unity runtime utilizes the latest Rive C++ runtime. All Rive features are supported for playback. Work is in progress to add runtime configuration support to the Unity package for Rive-specific features. For additional information, see here: https://help.rive.app/game-runtimes/unity#feature-support

## Table of contents

- ⭐️ [Rive Overview](#rive-overview)
- 🚀 [Getting Started](#getting-started)
- 👨‍💻 [Contributing](#contributing)
-[Issues](#issues)

## Rive Overview

[Rive](https://rive.app) is a real-time interactive design and animation tool that helps teams
create and run interactive animations anywhere. Designers and developers use our collaborative
editor to create motion graphics that respond to different states and user inputs. Our lightweight
open-source runtime libraries allow them to load their animations into apps, games, and websites.

🏡 [Homepage](https://rive.app/)

📘 [General help docs](https://help.rive.app/) · [Rive Unity docs](https://help.rive.app/game-runtimes/unity)

🛠 [Learning Rive](https://rive.app/learn-rive/)

## Getting Started

You will need a Unity editor that supports OpenGL or D3D11 for Windows, or a Mac with ARM64 (M1, M2, etc) architecture.

Select either D3D11/OpenGL for Windows, or Metal for Mac/iOS as the Graphics API under Project Settings -> Player in Unity.

You can install the Rive package for Unity by opening the Package Manager (Window -> Package Manager). And adding the latest tag as a git dependency:

```
[email protected]:rive-app/rive-unity.git?path=package#v0.1.10
```

You can also add it manually to your projects `Packages/manifest.json` file:

```
{
"dependencies": {
"app.rive.rive-unity": "[email protected]:rive-app/rive-unity.git?path=package#v0.1.10",
...
}
}
```

### Awesome Rive

For even more examples and resources on using Rive at runtime or in other tools, checkout the [awesome-rive](https://github.com/rive-app/awesome-rive) repo.

## Contributing

We love contributions! Check out our [contributing docs](./CONTRIBUTING.md) to get more details into how to run this project, the examples, and more all locally.

## Issues

Have an issue with using the runtime, or want to suggest a feature/API to help make your development
life better? Log an issue in our [issues](https://github.com/rive-app/rive-unity/issues) tab! You
can also browse older issues and discussion threads there to see solutions that may have worked for
common problems.
72 changes: 72 additions & 0 deletions examples/basic/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# This .gitignore file should be placed at the root of your Unity project directory
#
# Get latest from https://github.com/github/gitignore/blob/main/Unity.gitignore
#
/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/[Ll]ogs/
/[Uu]ser[Ss]ettings/

# MemoryCaptures can get excessive in size.
# They also could contain extremely sensitive data
/[Mm]emoryCaptures/

# Recordings can get excessive in size
/[Rr]ecordings/

# Uncomment this line if you wish to ignore the asset store tools plugin
# /[Aa]ssets/AssetStoreTools*

# Autogenerated Jetbrains Rider plugin
/[Aa]ssets/Plugins/Editor/JetBrains*

# Visual Studio cache directory
.vs/

# Gradle cache directory
.gradle/

# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
.consulo/
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
*.pdb
*.mdb
*.opendb
*.VC.db

# Unity3D generated meta files
*.pidb.meta
*.pdb.meta
*.mdb.meta

# Unity3D generated file on crash reports
sysinfo.txt

# Builds
*.apk
*.aab
*.unitypackage
*.app

# Crashlytics generated file
crashlytics-build.properties

# Packed Addressables
/[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin*

# Temporary auto-generated Android Assets
/[Aa]ssets/[Ss]treamingAssets/aa.meta
/[Aa]ssets/[Ss]treamingAssets/aa/*
5 changes: 5 additions & 0 deletions examples/basic/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"visualstudiotoolsforunity.vstuc"
]
}
10 changes: 10 additions & 0 deletions examples/basic/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Attach to Unity",
"type": "vstuc",
"request": "attach"
}
]
}
55 changes: 55 additions & 0 deletions examples/basic/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"files.exclude": {
"**/.DS_Store": true,
"**/.git": true,
"**/.gitmodules": true,
"**/*.booproj": true,
"**/*.pidb": true,
"**/*.suo": true,
"**/*.user": true,
"**/*.userprefs": true,
"**/*.unityproj": true,
"**/*.dll": true,
"**/*.exe": true,
"**/*.pdf": true,
"**/*.mid": true,
"**/*.midi": true,
"**/*.wav": true,
"**/*.gif": true,
"**/*.ico": true,
"**/*.jpg": true,
"**/*.jpeg": true,
"**/*.png": true,
"**/*.psd": true,
"**/*.tga": true,
"**/*.tif": true,
"**/*.tiff": true,
"**/*.3ds": true,
"**/*.3DS": true,
"**/*.fbx": true,
"**/*.FBX": true,
"**/*.lxo": true,
"**/*.LXO": true,
"**/*.ma": true,
"**/*.MA": true,
"**/*.obj": true,
"**/*.OBJ": true,
"**/*.asset": true,
"**/*.cubemap": true,
"**/*.flare": true,
"**/*.mat": true,
"**/*.meta": true,
"**/*.prefab": true,
"**/*.unity": true,
"build/": true,
"Build/": true,
"Library/": true,
"library/": true,
"obj/": true,
"Obj/": true,
"ProjectSettings/": true,
"temp/": true,
"Temp/": true
},
"dotnet.defaultSolution": "basic.sln"
}
Loading

0 comments on commit b40558c

Please sign in to comment.