|
|
| (同じ利用者による、間の25版が非表示) |
| 行1: |
行1: |
| − | ==Realtimedatabaseのインストール==
| + | [[Unity/Firebase/Realtimedatabase/インストール]] |
| − | FirebaseDatabase.unitypackageをAssets/Importからインストールする
| + | |
| | | | |
| − | https://firebase.google.com/download/unity?hl=ja
| + | [[Unity/Firebase/Realtimedatabase/基本]] |
| | | | |
| − | ==料金課金周り==
| + | [[Unity/Firebase/Realtimedatabase/更新]] |
| − | [[Gcp/Firebase/RealtimeDatabase]] [ショートカット] | + | |
| | | | |
| − | ==ルール==
| + | [[Unity/Firebase/Realtimedatabase/json]] |
| − | 以下のようなルールになってると、更新できないので、test時は修正後のように
| + | |
| − | 修正前
| + | |
| − | <pre>
| + | |
| − | {
| + | |
| − | "rules": {
| + | |
| − | ".read": false,
| + | |
| − | ".write": false
| + | |
| − | }
| + | |
| − | }
| + | |
| − | </pre>
| + | |
| − | 修正後
| + | |
| − | <pre>
| + | |
| − | {
| + | |
| − | "rules": {
| + | |
| − | ".read": true,
| + | |
| − | ".write": true
| + | |
| − | }
| + | |
| − | }
| + | |
| − | </pre>
| + | |
| | | | |
| − | ==サンプル==
| + | [[Unity/Firebase/Realtimedatabase/リスト]] |
| − | SampleScene.cs
| + | |
| − | <pre>
| + | |
| − | using System.Collections;
| + | |
| − | using System.Collections.Generic;
| + | |
| − | using UnityEngine;
| + | |
| | | | |
| − | using Firebase;
| + | [[Unity/Firebase/Realtimedatabase/削除]] |
| − | using Firebase.Database;
| + | |
| − | using Firebase.Unity.Editor;
| + | |
| | | | |
| − | public class SampleScene : MonoBehaviour
| + | [[Unity/Firebase/Realtimedatabase/切断]] |
| − | {
| + | |
| − | void Start()
| + | |
| − | {
| + | |
| − | // Get the root reference location of the database.
| + | |
| − | DatabaseReference reference = FirebaseDatabase.DefaultInstance.RootReference;
| + | |
| | | | |
| − | // 書き込み
| + | [[Unity/Firebase/Realtimedatabase/chat]] |
| − | FirebaseDatabase.DefaultInstance.GetReference("users")
| + | |
| − | .Child("age")
| + | |
| − | .SetValueAsync(10);
| + | |
| | | | |
| − | // 読み込み
| + | [[Unity/Firebase/Realtimedatabase/timestamp]] |
| − | FirebaseDatabase.DefaultInstance.GetReference("users")
| + | |
| − | .Child("age")
| + | |
| − | .GetValueAsync().ContinueWith(task =>
| + | |
| − | {
| + | |
| − | if (task.IsFaulted)
| + | |
| − | {
| + | |
| − | Debug.LogError("not found users");
| + | |
| − | }
| + | |
| − | else if (task.IsCompleted)
| + | |
| − | {
| + | |
| − | DataSnapshot snapShot = task.Result;
| + | |
| − | Debug.Log(snapShot.Value);
| + | |
| − | }
| + | |
| − | });
| + | |
| − | | + | |
| − | }
| + | |
| − | }
| + | |
| − | </pre>
| + | |
| − | 参考:https://firebase.google.com/docs/database/unity/retrieve-data?hl=ja
| + | |
| − | | + | |
| − | 参考:http://siguma-sig.hatenablog.com/entry/2018/09/30/213822
| + | |
2021年10月1日 (金) 14:43時点における最新版
Unity/Firebase/Realtimedatabase/インストール
Unity/Firebase/Realtimedatabase/基本
Unity/Firebase/Realtimedatabase/更新
Unity/Firebase/Realtimedatabase/json
Unity/Firebase/Realtimedatabase/リスト
Unity/Firebase/Realtimedatabase/削除
Unity/Firebase/Realtimedatabase/切断
Unity/Firebase/Realtimedatabase/chat
Unity/Firebase/Realtimedatabase/timestamp