如何从Fire-base数据库检索数据到Unity。 如何从Unity更新Firebase数据库中的数据。
答案 0 :(得分:2)
To retrieve data,检索数据部分。
通过一次性调用GetValueAsync()或附加到FirebaseDatabase引用上的事件来检索Firebase数据。对于数据的初始状态,会再次调用事件侦听器,并且只要数据发生更改,就会再次调用事件侦听器。
To save data,保存数据部分。
将数据写入Firebase Realtime有五种方法 数据库:
SetValueAsync() -- Write or replace data to a defined path, such as users/<user-id>/<username>.
SetRawJsonValueAsync() -- Write or replace data with raw Json, such as users/<user-id>/<username>.
Push() Add to a list of data. Every time you call Push(), Firebase generates a unique key that can also be used as a unique identifier, such as user-scores/<user-id>/<unique-score-id>.
UpdateChildrenAsync() -- Update some of the keys for a defined path without replacing all of the data.
RunTransaction() -- Update complex data that could be corrupted by concurrent updates.