Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/skibitsky/asuka
🏭 My Unity extensions and utilities
https://github.com/skibitsky/asuka
unity upm-package
Last synced: 3 days ago
JSON representation
🏭 My Unity extensions and utilities
- Host: GitHub
- URL: https://github.com/skibitsky/asuka
- Owner: skibitsky
- Created: 2021-02-09T16:34:19.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2022-06-28T19:24:14.000Z (over 2 years ago)
- Last Synced: 2024-01-27T23:38:41.274Z (10 months ago)
- Topics: unity, upm-package
- Language: C#
- Homepage:
- Size: 18.6 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# asuka
Asuka is the collection of little utilities and extensions I use when working in Unity.
The goal is to create a Unity Package that I could easily plug into any project and avoid reimplementing same things over and over again. It should be as easy as to put Asuka into Eva.
## Third-Party Extensions
I am trying to avoid third-party dependencies in this package. Still need to find a way to share my extensions for third-party libraries. For now, I will just put them below.
### UniRx
UGUI
```csharp
public static IDisposable BindTo(this IReactiveCommand command, Dropdown dropdown)
{
var d1 = command.CanExecute.SubscribeToInteractable(dropdown);
var d2 = dropdown.OnValueChangedAsObservable().SubscribeWithState(command, (x, c) => c.Execute(x));
return StableCompositeDisposable.Create(d1, d2);
}public static IDisposable BindTo(this IReactiveCommand command, InputField inputField)
{
var d1 = command.CanExecute.SubscribeToInteractable(inputField);
var d2 = inputField.OnValueChangedAsObservable().SubscribeWithState(command, (x, c) => c.Execute(x));
return StableCompositeDisposable.Create(d1, d2);
}public static IDisposable SubscribeToImage(this IObservable source, Image image)
{
return source.SubscribeWithState(image, (x, i) => image.sprite = x);
}
```Input System
```csharp
public static IObservable PerformedAsObservable(this InputAction action) =>
Observable.FromEvent(
h => action.performed += h,
h => action.performed -= h);public static IObservable PerformedAsUnitObservable(this InputAction action) =>
action.PerformedAsObservable().AsUnitObservable();
```