Twitter LogoFacebook Logo
Realtime Database - Get Data
Using the "Get Data" node to get data in Realtime Database.
By: King

Hello, in this tutorial, I will show you how to get data with the FBP Firebase Plugin for Unreal Engine.

To get data, use the “Get Data” node.

Image from Codeible.com

Then set the path to the Data you want get using the Data Path pin.

Image from Codeible.com

Lastly, add the callbacks by clicking and holding on the pin. Then drag to an empty space in the blueprint.

Image from Codeible.com

The On Value Received callback gets called when the value is retrieved from the Realtime Database. It returns a Data Snapshot object that we can use to get contents from the data using a series of Get nodes provided in the plugin.

The On Fail to Get Value callback gets called when it failed to get the data.

Image from Codeible.com

Getting the Contents from the Data

Once the setup is completed, use one or more of these Get nodes in the plugin to get the contents from the Data Snapshot.

• Get String
• Get Number
• Get Boolean
• Get String Array
• Get Number Array
• Get Boolean Array
• Get Map

If your data is just a single value entity, use Get String if it is a string, Get Number if it is a number and so on.

Image from Codeible.com

Since the path to the data is a single valued, the key should match with the last element in the Data Path array.

If it contains multiple data like this in Realtime Database:

Image from Codeible.com

Then you must use Get Map and then followed by the Get Nodes to get the data.

Image from Codeible.com

The example shows how to get data from the Map.

Attaching a listener

The "Get Data" node will only get the data once per use. If you want to continuously get updates from the data, use the "Listen to Value" node.

Image from Codeible.com

To set it up, set the path to the data you want to listen to using the Data Path pin.

Image from Codeible.com

Then, add the callbacks by clicking and holding on the pin. Then drag to an empty space in the blueprint.

Image from Codeible.com

The On Value Changed callback gets called once at the beginning to get the data. Then it’ll get called every time an update is made to it. Use the Data Snapshot object returned from it to get the data.

The On Cancel Value Listener gets called when there is an error that occurred during the process or when the listener is terminated.

Getting the Contents from the Listener

Once the setup is completed, use one or more of these Get nodes in the plugin to get the contents from the Data Snapshot.

If your data is just a single value entity, use Get String if it is a string, Get Number if it is a number and so on.

Image from Codeible.com

Since the path to the data is a single valued, the key should match with the last element in the Data Path array. 

If it contains multiple data like this in Realtime Database: 

Image from Codeible.com

Then you must use Get Map and then followed by the Get Nodes to get the data. 

Image from Codeible.com

Sign In