Hello
I have been reading the documentation and searching the forum but I didn´t find the answer. I´m really new with this amazing asset.
I have tried to set the autologin code in the start of a script in order to autologin when game starts:
string storedUsername, storedPassword;
if (User.CanAutoLogin(out storedUsername, out storedPassword))
{
User.AutoLogin((bool success, string error) => {
Debug.Log("AutoLogin: " + success + " -- " + error);
});
}
But I always have the same error:
Exception: Combu Manager not initialized
How can I know the Combu Manager state in order to wait until initialized to try the autologin?
Thank you very much
The reason is what the message says: you're calling this code before CombuManager component has been initialized (that is the initial connection has not been established).
You should use this code inside a coroutine, for example:
IEnumerator Start() { while (!CombuManager.isInitialized) yield return new WaitForFixedUpdate(); string storedUsername, storedPassword; if (User.CanAutoLogin(out storedUsername, out storedPassword)) { User.AutoLogin((bool success, string error) => { Debug.Log("AutoLogin: " + success + " -- " + error); }); } }
FRANCESCO CROCETTI @ SKARED CREATIONS
Great. Many many thanks. Now it´s fine and autologin is working. I don´t know yet if autologin works different from authenticate but now the parsing to my own user class has an error. When i do
GameControl.player = CombuManager.localUser as MyPlayer;
says
NullReferenceException: Object reference not set to an instance of an object
but with the manual login there was no problem.
Anyway, thank you very much for your great work.
Use the templated version of Autologin and pass your custom User class to it:
User.AutoLogin<MyPlayer>
FRANCESCO CROCETTI @ SKARED CREATIONS
Thank you very much. Something i´m still missing but don´t worry. I´m using many of your tools and learning so many things that probably I´m making something wrong because of my novelty. I am working fine with CombuManager.localUser.customData["mydata"] notation so i will come back to my own class later. This topic is answered so we can close it to avoid merge answers in a wrong title.
Thanks again for your time.