Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

AppCallbacks.Instance.Initialized Error in 5.4.1 (Win10 UWP)

Discussion in 'Windows' started by nowshow, Sep 29, 2016.

  1. nowshow

    nowshow

    Joined:
    Dec 26, 2015
    Posts:
    4
    Please follow the code below
    Code (CSharp):
    1. UnityPlayer.AppCallbacks.Instance.Initialized + = onInitialized;
    2.  
    3.         Private void OnInitialized ()
    4.         {
    5.             AppCallbacks.Instance.InvokeOnAppThread (() =>
    6.             {
    7.                 Debug.WriteLine ( "OnInitialized");
    8.             }, False);
    9.         }}
    10.     Public delegate void UnityEvent (object arg);
    11.     Public sealed class Communications
    12.     {
    13.         Public static void SetEvent (UnityEvent e)
    14.         {
    15.             UnityEngine.GameObject go = UnityEngine.GameObject.Find ( "Cube");
    16.             If (go! = Null)
    17.             {
    18.                 Go.GetComponent <XAMLConnection> (). OnEvent = new XAMLConnection.OnEvent (e);
    19.             }}
    20.             Else
    21.             {
    22.                 Throw new Exception ( "Cube not found, have exported the correct scene?");
    23.             }}
    24.         }}
    UnityEngine.GameObject go = UnityEngine.GameObject.Find ( "Cube"); will not work and the game will not load. 'go' is null, can't find 'cube' object. The same code works in 5.3.X.

    Is 5.4.x issues?
     
  2. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,722
    Do you use Unity splash screen?
    If you call IsInitialized() on AppCallbacks, does it report true?

    If you don't use Unity Splash Screen, you may also try using RenderingStarted event instead of Initialized.