「Unity/Firebase/Realtimedatabase」の版間の差分
提供: 初心者エンジニアの簡易メモ
(→料金課金周り) |
|||
| 行6: | 行6: | ||
==料金課金周り== | ==料金課金周り== | ||
[[Gcp/Firebase/RealtimeDatabase]] [ショートカット] | [[Gcp/Firebase/RealtimeDatabase]] [ショートカット] | ||
| + | |||
| + | ==ルール== | ||
| + | 以下のようなルールになってると、更新できないので、test時は修正後のように | ||
| + | 修正前 | ||
| + | <pre> | ||
| + | { | ||
| + | "rules": { | ||
| + | ".read": false, | ||
| + | ".write": false | ||
| + | } | ||
| + | } | ||
| + | </pre> | ||
| + | 修正後 | ||
| + | <pre> | ||
| + | { | ||
| + | "rules": { | ||
| + | ".read": true, | ||
| + | ".write": true | ||
| + | } | ||
| + | } | ||
| + | </pre> | ||
==サンプル== | ==サンプル== | ||
2020年11月14日 (土) 17:17時点における版
Realtimedatabaseのインストール
FirebaseDatabase.unitypackageをAssets/Importからインストールする
https://firebase.google.com/download/unity?hl=ja
料金課金周り
Gcp/Firebase/RealtimeDatabase [ショートカット]
ルール
以下のようなルールになってると、更新できないので、test時は修正後のように 修正前
{
"rules": {
".read": false,
".write": false
}
}
修正後
{
"rules": {
".read": true,
".write": true
}
}
サンプル
SampleScene.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Firebase;
using Firebase.Database;
using Firebase.Unity.Editor;
public class SampleScene : MonoBehaviour
{
void Start()
{
// Get the root reference location of the database.
DatabaseReference reference = FirebaseDatabase.DefaultInstance.RootReference;
}
}
参考:https://firebase.google.com/docs/database/unity/retrieve-data?hl=ja
