Unity 4 series release
In this release
- Do your work in
IEnumerator
/Coroutine methods. The pattern is yield return asyncAction
, just like the async await
pattern in .Net 5.0.
- Connect to your local server with
LiveData.Instance.Connect("wss://127.0.0.1:3000/websocket")
.
- Login with
yield return Accounts.LoginAsGuest()
, yield return Accounts.LoginWith(username, password)
or yield return Accounts.CreateAndLoginWith(email, username, password)
. Your token is saved!
- Declare a collection with
var myCollection = Collection<RecordType>.Create("collectionName")
. RecordType
should inherit from MongoDocument
.
- Subscribe to records with
yield return (Coroutine)Subscription.Subscribe("publishName")
.
- Observe collections with
collection.OnAdded
, collection.OnChanged
, and collection.OnRemoved
.
- Use
System.Linq
to query collections effortlessly.
Calling methods
using Meteor;
using UnityEngine;
using Extensions;
var methodCall = Method<ReturnType>.Call("functionName",arg1,arg2,arg3, ...);
yield return (Coroutine)methodCall;
Debug.Log(methodCall.Response.Serialize());