Unity Player Accounts : Multi-Platform Auth Login (Google, Apple, Email & More!) in 9 Easy Minutes

  Рет қаралды 7,736

Navarone

Navarone

7 ай бұрын

0:33 - Installing Authentication Package
0:58 - Connect Project
1:14 - Adding Player Accounts to Identity
1:27 - Client ID from Dashboard
1:40 - LoginController script
3:26 - UILogin script
6:40 -Testing
6:55 - Google Login
7:05 - Logged In
7:21 - Exporting to android
8:22 - Testing Android
8:34 - Matching Ids
Edit 5/2/2024
Code used in the video:
github.com/navarone77/UnityPl...
Quick disclaimer:
I usually don't use void with async methods but Unity has Action and UI methods that return void so Task would give error. I opted without Task.Run or anything since this is more focused on getting it working and its quicker this way.. If you're a c# veteran, don't cringe too hard :)
Unity Player Accounts Docs
docs.unity.com/ugs/en-us/manu...
Sorry for the audio loud keys :\

Пікірлер: 75
@javiergarcialopez8365
@javiergarcialopez8365 6 ай бұрын
Nice tutorial bro !! Thanks so much !!!
@navarone77
@navarone77 6 ай бұрын
you're welcome :) thanks for watching!
@hansfritz6026
@hansfritz6026 6 ай бұрын
nevermind i found the issue the code is not the problem during that setup phase in the unit dashboard i only selected ios/android but not PC. but if you dont select PC then testing on PC in the editor doesnt work. please continue this series its really helpful :-)
@navarone77
@navarone77 6 ай бұрын
Interesting find Good to know this for future, glad you got it all sorted! Happy Coding :)
@RELIM_RO
@RELIM_RO 5 ай бұрын
Thank you brother, was about to post something about it. then I read your comment and face palmed myself so hard XD.
@lukeydzbecx8319
@lukeydzbecx8319 6 ай бұрын
Bro thank u for this
@navarone77
@navarone77 6 ай бұрын
you're welcome!
@SelaMalka
@SelaMalka 4 ай бұрын
Thank you very much! great tutorial! One question though - can you think of a way to keep the player logged in even after he quit the application?
@navarone77
@navarone77 4 ай бұрын
Do you mean on the mobile device ?
@12Kefu
@12Kefu Ай бұрын
hey the code is great but you have to login every time you launch the app can you help me with the issue
@navarone77
@navarone77 Ай бұрын
You can make a system easily, after you login , you can use the method for detecting already cached player, using the method below docs.unity.com/ugs/en-us/manual/authentication/manual/cached-players
@goncalobarros4124
@goncalobarros4124 3 ай бұрын
this auth login is done with what on user end?what do they send to unity? I am asking because I am wondering how this will work if user changes smartphone and needs to have their account of the app/game on the new phone?
@navarone77
@navarone77 2 ай бұрын
unity simply uses their own auth system to communicate with the various APIs such as Google, Apple etc. All Information on privacy and such, could be found here docs.unity.com/ugs/en-us/manual/authentication/manual/privacy-and-consent Everything else is handled by each individual company
@hansfritz6026
@hansfritz6026 6 ай бұрын
unfortunatly im getting "error_description=The+request+is+missing+a+required+parameter+or+is+using+an+unsupported+parameter."
@navarone77
@navarone77 2 ай бұрын
Hi sorry for late reply, are you still having this issue? I wouldn't mind taking a look into it again, you'd have to provide me more detail on what going on or where is exactly that error appears. thanks!
@hansfritz6026
@hansfritz6026 6 ай бұрын
i rewatched everything still dont see what i missed is there maybe something set in LoginBtn for events that you didnt show ?
@navarone77
@navarone77 4 ай бұрын
Hey could you provide more details on how and when you get error message ? I'm trying to look into it
@indievisualgames345
@indievisualgames345 5 ай бұрын
Hi nice tutorial, Is there any way to have multi login methods for Google Apple and custom login, also in that case how the auto login will check in terms of scripting, eg a user has apple login, if google play login fails in auth then how it will come to apple login and check via scripting. on the login screen we have 3 ways to login that is google apple & custom email login
@navarone77
@navarone77 4 ай бұрын
Do you mean separately ? Google play by the way is a separate auth , this one is the Unity Player Login should cover all those mentioned already in vid. The Player Login method only waits for the token once logged in. Would you mind explaining the use case of what you're doing this for?
@NASA-Educational
@NASA-Educational 2 ай бұрын
so only the unity team can see if someone login to your app? like user's name,email and id?
@navarone77
@navarone77 2 ай бұрын
I'm not entirely sure how they handle the data in UGS, look into their PrivacyPolicy/TOS. Likely they only have access to the same public info you do, nothing private.
@xpi8857
@xpi8857 4 ай бұрын
I tried and couldn't get the avatar. Is there any way to get the avatar?
@navarone77
@navarone77 4 ай бұрын
Very interesting question, this might be an upcoming feature unity is implementing, I will look into a way to get this done beforehand though. thanks!
@fastsolution
@fastsolution 4 ай бұрын
did they removed the "unity player accounts" i cant see it in the services ?
@navarone77
@navarone77 4 ай бұрын
Did you install the Authentication package ? Just tested it on Unity 2023 as well, it is still there in Project Settings after you install Authentication.
@fastsolution
@fastsolution 4 ай бұрын
@@navarone77 yes i did but player accounts is not showing in services it shows online in the providers.. could it be the unity version issue ? i am using 2022.1.24f1
@fastsolution
@fastsolution 4 ай бұрын
it shows all the other providers like facebook,google,steam etc.. @@navarone77
@Nounsi_Dev
@Nounsi_Dev 3 ай бұрын
@@fastsolution restart the editor, atleast that how i sovle the issue
@MarwanSharaiha
@MarwanSharaiha 2 ай бұрын
@@Nounsi_Dev it can only be selected in Unity Cloud and then it reflects automatically in the Authentication tab.
@devonn6_
@devonn6_ 4 ай бұрын
It works fine on editor but on phone the app restarts again and goes to he login page...Any solutions
@navarone77
@navarone77 4 ай бұрын
I tested on phone as you see in video and seems to work , would you mind sharing more info on your setup ?
@devonn6_
@devonn6_ 4 ай бұрын
@@navarone77 yes..but let me try one more time...
@devonn6_
@devonn6_ 4 ай бұрын
@@navarone77 one think I want to say that when I click on login it will open a browser and try to login..but when it goes back after login from the browser ...the game will restart ..its seems its not running on background. .any solution ?
@navarone77
@navarone77 4 ай бұрын
@@devonn6_ hmm that is strange, something might be wrong with your code I'm thinking. Just tested everything again and seems to work here. Perhaps try it on a brand new project just to test out?
@devonn6_
@devonn6_ 4 ай бұрын
@@navarone77 we need to write code for making our app run on recent background apps?..
@Ant_Dude_YT
@Ant_Dude_YT 6 ай бұрын
Wow that's cool if u need a backup system or online game which I can't get lol
@navarone77
@navarone77 6 ай бұрын
Not just for backups, its also useful for creating Player Gaming accounts, and other features like that. A Connection to the internet is needed though for any authentication.
@frostypixelsgames9350
@frostypixelsgames9350 6 ай бұрын
how do you log out ? of the account, it alays logs tothe same account on google
@navarone77
@navarone77 6 ай бұрын
good question, I will look into this again tomorrow for sure and will get back at you with an answer. Did you try the AuthenticationService class Logout method already? iirc that should delete any previous tokens, will verify how it is on browser thought to be sure.
@frostypixelsgames9350
@frostypixelsgames9350 6 ай бұрын
yes, i found out the solution it works , but the browser keeps remembering the auth@@navarone77
@aize7887
@aize7887 Ай бұрын
@@navarone77 I tried AuthenticationService.Instance.SignOut(true); but seem the player haven't acutally signed out "PlayerAccountsException: Player is already signed in. Unity.Services.Authentication.PlayerAccounts.PlayerAccountServiceInternal.StartSignInAsync (System.Boolean isSigningUp) (at ./Library/PackageCache/com.unity.services.authentication@3.3.1/Player Accounts/Runtime/PlayerAccountServiceInternal.cs:60)"
@aize7887
@aize7887 Ай бұрын
@@navarone77 Could you help us fix this, please?
@navarone77
@navarone77 Ай бұрын
@@aize7887 hey did you check my previous reply ? There should be a logout method on the AuthenticationService
@hardworkerstudio
@hardworkerstudio 4 ай бұрын
it really difficult to follow your typing, some class are missing some class are don't know what namespace you used, you should add all script to description, so, people can easily copy them
@navarone77
@navarone77 4 ай бұрын
Sorry you had troubles, not sure classes were missing. Okay I will add all the scripts to description
@NASA-Educational
@NASA-Educational 2 ай бұрын
how to logout after login?
@navarone77
@navarone77 2 ай бұрын
AuthenticationService.Instance.SignOut will sign out, you can pass a bool to clear credentials. Docs: docs.unity.com/ugs/en-us/packages/com.unity.services.authentication/2.6/api/Unity.Services.Authentication.IAuthenticationService#Unity_Services_Authentication_IAuthenticationService_SignOut_System_Boolean_
@zarplay.official
@zarplay.official Ай бұрын
Is it possible to block players through this system?
@navarone77
@navarone77 Ай бұрын
You can disable an account with Player Management system.
@zarplay.official
@zarplay.official Ай бұрын
​@@navarone77how?
@zarplay.official
@zarplay.official Ай бұрын
​@@navarone77hooow?
@zarplay.official
@zarplay.official Ай бұрын
You delete comment?
@navarone77
@navarone77 Ай бұрын
@@zarplay.official No I don't think so. It still shows fro me. I said you can disable accounts inside the Player Management system
@juancarlosiglesiasburgueno5296
@juancarlosiglesiasburgueno5296 4 ай бұрын
And how to register? Or it is in? Sorry for my atrevement but first is register. Please tell me. Thanks.
@navarone77
@navarone77 2 ай бұрын
The account is already a registered account by using the other providers, you can also sign up with email and password. It takes care of registration for you
@hansfritz6026
@hansfritz6026 6 ай бұрын
would you mind including this in your next video ? ugs/manual/authentication/manual/best-practices this includes first time user experience which i am struggling right now. i want a anonymous login in the background and a check for cached user and then later offer the player a UI popup with the offer of linking with an actual google or apple account
@navarone77
@navarone77 6 ай бұрын
Prefect timing! I am actually working on a series on this Unity system, that also includes doing Player Profiles, chat features and also game avatars ofc :) I'll be sure to drop the video with your suggestions first, thanks for reminder! if you haven't already, don't forget to subscribe and stay tuned
@hardworkerstudio
@hardworkerstudio 4 ай бұрын
I feel thank you for making this VDO a bit But!!! why do you add functions to Buttons by scripts? this is you are making a Tutorial VDO, and your typing is also very difficult to follow something should add first, But you add last, it so wiered and it not makesense at all!
@navarone77
@navarone77 4 ай бұрын
Thank you for the feedback, I'll certainly make note of your suggestion about the order of elements in the video. Is there a specific part this occurs? I'll review and adjust accordingly for future content. Regarding the buttons,assigning them in code for better clarity. It's definitely helpful to have all references visible in the code editor for easier management and understanding what is linked to what without going through inspector or unity Editor every time. Thanks again for your insights!
@jacobjacob5735
@jacobjacob5735 2 ай бұрын
Why did you not upload the code? At least write it in the description or as a comment. Without comment and then also sped up. Not really as helpfull as I had hoped...
@navarone77
@navarone77 2 ай бұрын
It's pretty straight forward, but I can see how it can be useful to have source code. I will do so in the next videos. Appreciate the Feedback
@AsTrO-zq1kz
@AsTrO-zq1kz 2 ай бұрын
​@@navarone77bro pls reply. So,If we use this login system,this can save the in-game data for each account for example,the level of player or something they have collected?And once they logout and then login again ,may the data be saved for that account.?
@TheCollectiveYoutube
@TheCollectiveYoutube 2 ай бұрын
​@@AsTrO-zq1kz yes, but you use learn how to read and write to the database
@navarone77
@navarone77 2 ай бұрын
@@AsTrO-zq1kz That is correct, this allows to store data for each one of those player accounts via Unity Cloud Save. I have an intro video on intro to Cloud Save , working on a series to do dashboard for players to manage their own data. Subscribe to stay tuned, should be dropping in a few weeks
@navarone77
@navarone77 2 ай бұрын
Hey there, I've uploaded the code/project used in the video. Hope it helps github.com/navarone77/UnityPlayerLogin_Example
Я нашел кто меня пранкует!
00:51
Аришнев
Рет қаралды 3,9 МЛН
Did you believe it was real? #tiktok
00:25
Анастасия Тарасова
Рет қаралды 49 МЛН
UNITY Tutorial : Email Authentication using Firebase
7:06
Vikings Devlogs
Рет қаралды 9 М.
Fake Illusions
17:26
Icely Puzzles
Рет қаралды 10 М.
Unity Send data to a SERVER (Login System) , PHP & MYSQL
6:29
Hamza Herbou
Рет қаралды 50 М.
[Unity] GPGS v11.01 settings, login, achievements, leaderboard creation
31:34
EASIEST Login and Registration System in UNITY C#
14:34
grengsta
Рет қаралды 12 М.
How To Use GOOGLE PLAY GAMES SERVICES With UNITY!
23:06
Freedom Coding
Рет қаралды 5 М.
Authenticate users using google in Unity and Firebase with OAuth2.0
20:55
Unity Gaming Services: User Authentication with Username & Password
33:09
Magnetic 🧲 #настольныеигры #boardgames #games #игры #настолки #настольные_игры
0:34
Fortnite mini Aquarium
0:40
RAWWFishing
Рет қаралды 6 МЛН
Unboxing MEGATRON 40th Anniversary Limited Edition Robot by Robosen
1:00
A clash of kindness and indifference #shorts
0:17
Fabiosa Best Lifehacks
Рет қаралды 10 МЛН
elini ver elini tutarım #funny #baby #cute #cutebaby #shortvideo #keşfet
0:19