Search Unity

UWP Xbox Live Sign in Pop-up?

Discussion in 'Windows' started by cocacough, Jan 18, 2019.

  1. cocacough

    cocacough

    Joined:
    Jul 1, 2015
    Posts:
    78
    Hi,

    I'm trying to call the method User.SignInAsync(m_uiDispatcher) but I don't see the sign in popup when I call it. The same happens when I use User.SignInSilentlyAsync(m_uiDispatcher). What's the difference anyway?

    I am able to sign in using the Xbox App on Windows then only will my game sign in using the same account. Any idea how can I get the sign in pop-up to appear?
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Which thread are you invoking that method from?
     
  3. cocacough

    cocacough

    Joined:
    Jul 1, 2015
    Posts:
    78
    Last edited: Jan 21, 2019
  4. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Can you show your code that calls it? It needs to be invoked from Windows UI thread, which is a different thread than where your script callbacks (Start(), Update(), etc) are called.
     
  5. cocacough

    cocacough

    Joined:
    Jul 1, 2015
    Posts:
    78
    I managed to find a workaround. Somehow the sign in doesn't pop up when I call the method at Start() so I had to explicitly call it again and then it comes up.
     
  6. youennThirion

    youennThirion

    Joined:
    Apr 2, 2017
    Posts:
    27
    Hi,
    I got a problem with signinAsync and I call it from start(). Could you explain this point ?
     
  7. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Sure. When running Unity game on UWP, there are two main threads that you might care about:

    • System UI thread. This thread is where interaction with native UI elements has to happen.
    • Unity main thread. This is the thread all of your scripts and game logic run on.

    If you call into system UI on the Unity main thread, you will likely crash.

    You can jump from one thread to another using these APIs:

    https://docs.unity3d.com/ScriptReference/WSA.Application.InvokeOnAppThread.html
    https://docs.unity3d.com/ScriptReference/WSA.Application.InvokeOnUIThread.html