Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/comradevanti/unitywaitforanim
A custom yield-instruction for Unity to wait for animations to finish
https://github.com/comradevanti/unitywaitforanim
animation animator async coroutine package unity unity3d utility wait yield
Last synced: about 1 month ago
JSON representation
A custom yield-instruction for Unity to wait for animations to finish
- Host: GitHub
- URL: https://github.com/comradevanti/unitywaitforanim
- Owner: ComradeVanti
- License: unlicense
- Created: 2022-02-25T14:11:04.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-03-19T10:34:45.000Z (9 months ago)
- Last Synced: 2024-03-19T11:50:44.408Z (9 months ago)
- Topics: animation, animator, async, coroutine, package, unity, unity3d, utility, wait, yield
- Language: C#
- Homepage:
- Size: 29.3 KB
- Stars: 35
- Watchers: 4
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# WaitForAnim
[![openupm](https://img.shields.io/npm/v/dev.comradevanti.wait-for-anim?label=openupm®istry_uri=https://package.openupm.com)](https://openupm.com/packages/dev.comradevanti.wait-for-anim/)
A Unity-package for waiting for animations in coroutines.
Check out the wiki [here](https://github.com/ComradeVanti/UnityWaitForAnim/wiki).
Found any issues? Leave
them [here](https://github.com/ComradeVanti/UnityWaitForAnim/issues).Want to see what's new? The changelog
is [here](https://github.com/ComradeVanti/UnityWaitForAnim/blob/main/CHANGELOG.md).**⚠️ Development is paused ⚠️**
No new features will be added or bugs fixed unless requested through an issue.
If you wish to fork this repository and continue the work, you are very welcome
to do so.## Features
### Start an animation and wait for it to finish
If you want to wait for an animation to stop playing, you can use `WaitForAnimationToFinish`.
```csharp
yield return new WaitForAnimationToFinish(animator, "MyAnim");
```You can also start an animation and wait for it to finish using the extension method `PlayAndWait`.
```csharp
yield return animator.PlayAndWait("MyAnim");
```### Wait for an animation to start
If you want to wait for an animation to start playing, you can use `WaitForAnimationToStart`.
```csharp
yield return new WaitForAnimationToStart(animator, "Test");
```## Installation
The quickest way is to install via [OpenUPM](https://openupm.com)
using `openupm add dev.comradevanti.wait-for-anim`.Or install manually
as [git dependency](https://docs.unity3d.com/Manual/upm-ui-giturl.html)
from `https://github.com/ComradeVanti/UnityWaitForAnim.git` or download as zip
and [import locally](https://docs.unity3d.com/Manual/upm-ui-local.html).## Compatability
Developed with Unity 2020.3 but good chance that it will work with earlier
versions, though this has not been tested.