From the course: Unity: Working with Google Firebase

Unlock the full course today

Join today to access over 22,700 courses taught by industry experts or purchase this course individually.

Handle changing data

Handle changing data

From the course: Unity: Working with Google Firebase

Start my 1-month free trial

Handle changing data

- [Instructor] Let's take a look at some of the different methods we can use to pull data. In our get players call, we used our router, and we used the get value async method. Using the get value async method is a one-time call, so what if we wanted to take a more dynamic approach to our list view? Well, since our database is real time, we can subscribe to a number of different built in events on any given router. For example, what if we took our router, players, and use the value changed call instead of get value async? Well, that would fire every time there was any kind of change to data under that node. However, if we wanted to be more specific, we could say "router players," and only fire when a new child is added. Let's do a more practical example in code here. In our player board manager, in the Awake function, I'm going to go ahead and comment out our database manager call. On a Mac commenting out in bulk is Command /, so I'm going to save that, and instead, I'm going to use…

Contents