Unity Firebase Database Integration - Easy Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi everyone in this video we will integrate the firebase database in unity after this video you should check out these videos on my channels let's start first of all we are going to open firebase console from console.firebase.google.com after that click create a project and type your project name this part is about analytics but we won't be using it for now then click create project button as you can see we created our project on firebase then we have to open the project settings in this part we will add our unity app enter your package name and application name then click register a button click next and go back to the project settings page from here we'll download the google services json file after the file is downloaded drag the file into your project then go back to the console in here expand the build section and click on the real-time database then click create database button in this part you can choose your location of database and security rules in security rules choose start in locked mode and click enable button so in the real tab we'll have some changes in order to read and write the data we need to make the read and write part true just dismiss that warning so the next step is downloading of the firebase database sdk you can download it from this website the sprayer contains all firebase packages but we only need database then import this file into your project now we are ready to start first i create a script and name it database manager and i add the secret to my scene then i get db reference code which is on the website and import the libraries after that we need to create user class if you want you can get the sample on the website so we'll have two variables they are name and gold after we create a constructor and define the parameters then go back to the dbmanager class and create a method called createuser after that define a userwriter variable and set the user id to system info.device unique identifier this command will give you a unique id then i define the input fields on the screen after that create a new user and put your input field text in it then define a json variable to turn new user to json format [Music] then type the reference dot child user.child user id etc json value sync after that drag your files to their places and call create user method from your save button so let's test it [Music] as you can see the users table has been created and the user information has been saved under a unique id the next step is to fetch the data we have saved for this create ian numerator get name method and it will take action parameter then create a username data and get data from the reference like in the samples after that we input yield return new waits until username data dot is completed then create a snapshot object and invoke the snapshot value [Music] that's it we'll follow the same path to get other data create a get gold method with action in parameter then copy and paste the codes we just brought and make minor changes in this part after that we'll call this methods from another function because we need to call that from button then create the gold and name texts after all call this methods with start corroding and set texts then drag your texts to their places and call your method from your get button [Music] you got an error let's fix it change uppercase you to lowercase view in user section and parse gold's invoke like this let's try again as you can see the data has been fetched so after that we add a new button to update our data [Music] then create a update name method and use dbreference.childusers.childuserid.js that name that set value async and set your name input field in it and likewise create method for gold then copy and paste from the name part and change the part as needed after that assign the methods to the update button we created so let's test it [Music] as you can see the data is updated without any problems so we are done it's easy isn't it if you like this video please subscribe my channel also leave a comment see you on the next video [Music] you
Info
Channel: Solo Game Dev
Views: 63,756
Rating: undefined out of 5
Keywords: unity firebase db, unity firebase database, firebase unity database, unity database, firebase database unity, unity firebase, firebase unity tutorial, firebase unity, firebase database in unity, unity db, unity ve firebase, firebase unity android, firebase in unity, unity firebase realtime database, how to use firebase in unity, firebase database, database, firebase realtime database, realtime database, firebase tutorial, unity tutorial, unity & firebase, unity3d, Firebase
Id: 59RBOBbeJaA
Channel Id: undefined
Length: 7min 22sec (442 seconds)
Published: Sun Nov 28 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.