Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/coryleach/unitygiphy
Library for using the GiphyAPI in Unity to get and play random Gifs as MP4s
https://github.com/coryleach/unitygiphy
api gif giphy package ugui ui unity unity3d
Last synced: 3 months ago
JSON representation
Library for using the GiphyAPI in Unity to get and play random Gifs as MP4s
- Host: GitHub
- URL: https://github.com/coryleach/unitygiphy
- Owner: coryleach
- License: mit
- Created: 2020-05-13T05:28:44.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-06-13T22:47:37.000Z (over 4 years ago)
- Last Synced: 2024-01-28T23:12:58.479Z (about 1 year ago)
- Topics: api, gif, giphy, package, ugui, ui, unity, unity3d
- Language: C#
- Size: 99.6 KB
- Stars: 38
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
Gameframe.Giphy 👋
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/5b5f5409ad6f4cb8aea6cd40b457a55f)](https://www.codacy.com/manual/coryleach/UnityGiphy?utm_source=github.com&utm_medium=referral&utm_content=coryleach/UnityGiphy&utm_campaign=Badge_Grade)
![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/coryleach/UnityGiphy?include_prereleases)
[![openupm](https://img.shields.io/npm/v/com.gameframe.giphy?label=openupm®istry_uri=https://package.openupm.com)](https://openupm.com/packages/com.gameframe.giphy/)
[![license](https://img.shields.io/github/license/coryleach/UnityGiphy)](https://github.com/coryleach/UnityGiphy/blob/master/LICENSE)[![twitter](https://img.shields.io/twitter/follow/coryleach.svg?style=social)](https://twitter.com/coryleach)
This package contains a simple implementation of the Giphy API required to display random Gif images in Unity as MP4 videos.
This package does not provide a means to display a gif directly but does provide urls to gif version of the images.
Instead this package uses the mp4 links provided by giphy's api to display the gifs as movies## Quick Package Install
#### Using UnityPackageManager (for Unity 2019.3 or later)
Open the package manager window (menu: Window > Package Manager)
Select "Add package from git URL...", fill in the pop-up with the following link:
https://github.com/coryleach/UnityGiphy.git#2.0.0#### Using UnityPackageManager (for Unity 2019.1 or later)
Find the manifest.json file in the Packages folder of your project and edit it to look like this:
```js
{
"dependencies": {
"com.gameframe.giphy": "https://github.com/coryleach/UnityGiphy.git#2.0.0",
...
},
}
```#### Using OpenUPM
The package is available on the [openupm registry](https://openupm.com/packages/com.gameframe.giphy/). It's recommended to install it via [openupm-cli](https://github.com/openupm/openupm-cli#openupm-cli).
```
openupm add com.gameframe.giphy
```## Usage
To get started you must create an app and get an API key on the https://developers.giphy.com/ website.
Create your GiphyConfig asset by using the Create->Gameframe->Giphy->Config in the project tab's Create menu.
Once you have created your GiphyConfig asset you should add your API key to it that you got from the Giphy developer website.
You can use your config asset and the demo scene included in this package to get started.This library provides a GiphyRawImageController component that can be used with RawImage and VideoPlayer
for displaying random giphy images in your UI but example API code is also shown below.```C#
//You can make basic queries to Giphy using the API provide in the GiphyQuery class.
//As of this writing only Random and Search endpoints are supported.
//For more info on the query results please see the following documentation
// https://developers.giphy.com/docs/api/endpoint//Example code that loads a random image and plays it as a video
public async void ShowRandomImage()
{
//Get a single random result
var randomResult = await GiphyQuery.Random(apiKey,searchKeywords);//Display the random image result using Unity's video player
videoPlayer.source = VideoSource.url;
videoPlayer.url = randomResult.result.data.images.original_mp4.mp4;
videoPlayer.Play();
}
```## Author
👤 **Cory Leach**
* Twitter: [@coryleach](https://twitter.com/coryleach)
* Github: [@coryleach](https://github.com/coryleach)## Show your support
Give a ⭐️ if this project helped you!
***
_This README was generated with ❤️ by [Gameframe.Packages](https://github.com/coryleach/unitypackages)_