Skip to content

Type-safe extensions and helpers for using Firebase Tasks in Unity

License

Notifications You must be signed in to change notification settings

gazialankus/Unity-Thenable-Tasks

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Unity-Thenable-Tasks

This library is based on Unity-Parse-Helpers.

Since Firebase uses Parse's Unity Tasks library, I found Unity-Parse-Helpers to be useful. However, it also has other Parse-related things that we don't need in Firebase and that prevent compilation without Parse. So, I created this repo to host only the task-related parts of Unity-Parse-Helpers.

Below are the related documentation from Unity-Parse-Helpers.

This library provides a number of helpers and utilities for dealing with Parse.com in Unity 3D

Task Chaining

A series of extension methods have been provided that let you chain together calls in a Javascript-Promise like manner:

 // Signup
userService.Signup(usernameInp.text, passwordInp.text, playernameInp.text)

	// Then Login
	.Then(t => userService.Login(usernameInp.text, passwordInp.text))

	// Then we are done
	.Then(OnLoggedIn, OnError);             

Looming

Using the extension ".OnMainThread()" for Task you can ensure that your Parse async calls always run in the main thread:

public Task<GameUser> Login(string email, string password)
{
	Debug.Log("Logging in..");

	return ParseUser.LogInAsync(email, password)
		.OnMainThread()
		.Then(t => Task.FromResult((GameUser)t.Result));
}

Installation

Checkout this project as a sub-module in your project, and you should be good to go!

About

Type-safe extensions and helpers for using Firebase Tasks in Unity

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 100.0%