Firebase Analytics and Custom Events in Unity 2D & 3D | Quick & Easy Tutorial | Fix All the Errors

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome back today we are going to implement Firebase analytics into Unity so let's begin first of all let's go to the console of Firebase log into the Firebase and go to the console let's create a new project Firebase tutorial then let's turn on the enable Google analytics for this project and hit continue and select an account that's default for now let's create a project might take some time for you let's continue then click on to the unity and uh if you want to create for iOS you can do it as well for now I'm going to do with the Android app now we need to add a uh package name you can do it first of all you need to convert your project into Android might take some time some time as well then go to project settings then check and and check the default package name you will get a package name you can change it as well for now I'm going to use it use the default one and you can paste it there and write give a name for the app optional which is then download the jsn file as the step shows then paste it into the assets then don't forget to rename if it's multiple times like it should be Google services not any space other than that then I like to keep it organized so I'm going to create a new folder for it and I'm going to then let's click next then download Firebase SDK let it download then I'm going to click next next steps are here you can go to the documentation for that continue to the console okay our first first stage is done while downloading I'm going to say you something like uh if you want to like use something uh you can add sha fingerprint for it you can get sha fingerprint by by the key you are providing if you want to do it I'll make another video on that now let's extract it and let's uh there are multiple packages of Firebase today I'm going to do just the analytics package let's drag and drop and might take some time okay uh click on all and let's import it even this might take time as well it should it should be like this this popup should be shown then you need to click yes then enable if you want Auto resolution and right now I'm getting an error uh this is just a simple error uh you must need to install the iOS model since I have not installed that module just a simple fix you need to download iOS build support the error name is like as you can see it's just simple shows that then yeah let should do it yeah it fixed then resolve might take some time as well if resolve takes quickly then you need to do like force resolve it should take time some time to load you know and let's create an empty object to initialize the Firebase let's name it Firebase in it then let's add a script uh I have created a script already it's just a simple script uh let's remove all the basic stuffs let's go to the documentation and let's see how we can initialize it's just we need to post this in I mean paste this inside um the start method private void start and let's paste it uh you might see a error in this yeah like it's just a simple fix you need to declare the type of it Firebase do Firebase app fire base app okay and that should fix it I you can uh shorten the proced like Steps by adding using statement using system and using Firebase and remove unnecessary codes let's create a button functions region and let's create two methods for it let's name log me button something like that okay then yeah let's create one more method for another two functions this is for uh uh analytics based on the parameters we passed so we can get accurate results like what we pass for example we can do it for scores and other stuffs for now I'm going to use a single number I mean in let's take number L base log events okay fbas analytics. log event and you you need to do one thing you you shouldn't leave any space between the strings because it won't be visible if you do so so you need to keep that in mind we shouldn't leave any space between the strings uh okay that's good now we are going to do using parameter uh press number button comma uh this is uh Syntax for it to create a parameter based logs okay if you want to use multiple parameters you can do it like uh array method like parameter array and uh create new parameter and put comma and that kind of stuff just let me just copy and paste it by adding comma uh this is how you can add multiple parameters for now I'm going to use a single parameter let's get back to the buttons and let's add the object to the required slots and let's change the parameters for two different buttons like one and two yeah that is that should be it let's run it oh that's that warning is you can ignore that warning that's because the database thing of Firebase because we are not using database and that should be it let's run it on my device it should work without any problem I like to keep it organized so let me fire base tutorial okay oh okay if you are stuck in this manner like I post Gradle call back something like this you need to do this thing you need to check these two custom main manifest and custom settings template gradel settings and then you need to resolve like force resolve then that should fix the problem in fact it should it should that's because uh it it patches the Android Force resolve patches the those custom files so it should fix the problems you can see it in its settings let's build it one more time okay that's playing I mean replacing Ah that's it built successfully let's click on to the buttons there's no user AC you need to like wait for maybe an hour or half an hour it takes time to reflect in the console you can see it in real time analytics okay there it comes for me it took like uh half an or there's the logs I have pressed you can get into the number button press that's where I have used the parameter thing uh there where is it okay button number that's where these are the two numbers we gave to the two different buttons and yeah that should be it bye subscribe
Info
Channel: Cody Pie
Views: 1,706
Rating: undefined out of 5
Keywords: Unity Firebase Analytics Tutorial
Id: NQwnSBJzims
Channel Id: undefined
Length: 9min 26sec (566 seconds)
Published: Tue Dec 26 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.