I was able to get this event before while using the NetCore backend in Unity 2018, but now that I’m forced to use IL2CPP in Unity 2019, this event no longer seems to be triggered. The C++ generated code for the event registration and handling is there, but I never get the event.
public class HoloLensExternalDataInput : MonoBehaviour
{
// Use this for initialization
void Start ()
{
Debug.Log("HoloLensExternalDataInput-Start");
UnityEngine.WSA.Application.windowActivated += Application_windowActivated;
}
private void Application_windowActivated(UnityEngine.WSA.WindowActivationState state)
{
var arguments = UnityEngine.WSA.Application.arguments;
Debug.Log("Application_windowActivated - arguments: " + arguments);
}
}
I see the Log statement for the Start method, but never the Log statement for the actual event.
I do see the built in log statements when running the app in debug mode:
[32.297251 / 41.280151] - OnWindowActivated event - Deactivated.
[1.585198 / 42.865348] - OnVisibilityChanged event - Hidden.
‘JTViewer.exe’ (Win32): Loaded ‘C:\Windows\System32\msxml6.dll’. Cannot find or open the PDB file.
[18.973996 / 61.839344] - OnHolographicWindowActivated event - CodeActivated.
[0.322481 / 62.161825] - OnVisibilityChanged event - Visible.
[0.020812 / 62.182637] - OnHolographicWindowActivated event - Deactivated.
[0.007574 / 62.190210] - OnWindowActivated event - CodeActivated.