Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

win8 store game, crash in window activated event

Discussion in 'Windows' started by QingFeng-Zhou, Jan 29, 2015.

  1. QingFeng-Zhou

    QingFeng-Zhou

    Joined:
    Dec 22, 2014
    Posts:
    20
    Code (CSharp):
    1.          protected override void OnWindowCreated(WindowCreatedEventArgs args)
    2.         {
    3.             args.Window.Activated += onActivated;
    4.         }
    Code (CSharp):
    1.         void onActivated(object sender, WindowActivatedEventArgs e)
    2.         {
    3.             appCallbacks.InvokeOnAppThread(() =>
    4.             {
    5.                 UnityEngine.Debug.Log("OnApplicationPause " + (e.WindowActivationState == CoreWindowActivationState.Deactivated));
    6.             }, false);
    7.         }
    玩家点击评分按钮后,应用商店就会被打开,调试中有 OnWindowActivated event - Deactivated 和 OnWindowSizeChanged event , m_Initialized=True. ,但是没有OnApplicationPause的输出。这是游戏卡死,无任何响应,过会就闪退了。
    If player click review button, market app will be opened. the debug window has "OnWindowActivated event - Deactivated" and "OnWindowSizeChanged event , m_Initialized=True.", but has no "OnApplicationPause". The game maybe death, it does not respond, and will crash after some time.
    Excuse me, my English is very bad.
     
  2. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,672
  3. QingFeng-Zhou

    QingFeng-Zhou

    Joined:
    Dec 22, 2014
    Posts:
    20
    If log "hello", no exception. But log e.WindowActivationState and game window is full, the game will death.
     

    Attached Files:

  4. QingFeng-Zhou

    QingFeng-Zhou

    Joined:
    Dec 22, 2014
    Posts:
    20
    There have a new bug, if touch xaml ui, unity can handle the touch also.
     
  5. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,642
    I guess you log to early (before Unity has initialized). AppCallbacks class has an event for that.
    When you touch XAML controls, Unity also receives this input. You can disable that by calling AppCallbacks.UnitySetInput().