Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Deep linking with il2cpp

Discussion in 'VR' started by Cutedge242, Apr 23, 2019.

  1. Cutedge242

    Cutedge242

    Joined:
    Nov 20, 2012
    Posts:
    9
    As part of our development, we are switching from Unity 2017.4 to Unity 2018 (and later 2019) and as part of that, we are also switching from the .net scripting backend to il2cpp. Everything is generally fine, but we were using deep linking and grabbing parameters out of the activation uri.

    In c# this looks like this:
    Code (CSharp):
    1.         private void ApplicationView_Activated(CoreApplicationView sender, IActivatedEventArgs args)
    2.         {
    3.             if (args.Kind == ActivationKind.Protocol)
    4.             {
    5.                 var arg = args as ProtocolActivatedEventArgs;
    6.  
    7.                 m_AppCallbacks.InvokeOnAppThread(
    8.                     () =>
    9.                     {
    10.                         // store uri for later processing
    11.                         UWPUtils.LaunchUri = arg.Uri;
    12.                         OurAppNameManager.Instance.ProcessCommandArguments();
    13.                     }, false);
    14.             }
    15.  
    16.             CoreWindow.GetForCurrentThread().Activate();
    17.         }
    In c++, you can still get the same method as:
    Code (CSharp):
    1. void App::OnActivated(CoreApplicationView^ sender, IActivatedEventArgs^ args)
    2. {
    3.     if (args->Kind == Windows::ApplicationModel::Activation::ActivationKind::Protocol)
    4.     {
    5.         Windows::ApplicationModel::Activation::ProtocolActivatedEventArgs^ eventArgs =
    6.             dynamic_cast<Windows::ApplicationModel::Activation::ProtocolActivatedEventArgs^>(args);
    7.  
    8.     }
    9.  
    10.     m_CoreWindow->Activate();
    11. }
    12.  
    However, I'm kind of unfamiliar with c++ so I don't know how to (a) create the lambda function or (b) call into my c# code. Is that even possible?
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    7,757
unityunity