Search Unity

Load file from OneDrive directory,but the ENABLE_WINMD_SURRPORT is always false

Discussion in 'Windows' started by keng123, Apr 16, 2019.

  1. keng123

    keng123

    Joined:
    Apr 15, 2019
    Posts:
    3
    Hi
    I'm trying to develop a unity application for hololens and I need to load a text file as a data source to visualize at runtime.
    My toolchain:
    -- Mixed Reality Toolkit v.2.0.0 RC1
    -- Unity 2018.3.12f1 personal
    -- Visual Studio Community 2017 (15..9.11)
    -- HoloLens OS v.10.0.14393.2125
    -- Windows 10 v.18362.53
    --Win 10 SDK 10.0.17763.0
    My Unity Player setting:
    Scripting Runtime Version:.Net 4.x
    Scripting Backend:IL2CPP
    Api Compatibility Level:.NET 4.x

    I use these code to access the fileOpenPicker component to load file,

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using System.Diagnostics;
    using System.Runtime.CompilerServices;
    using System.Threading;
    using System.Threading.Tasks;
    using System;
    using UnityEngine.WSA;
    using UnityEngine.UI;

    #if ENABLE_WINMD_SUPPORT
    using Windows.Storage;
    using Windows.Storage.Streams;
    using Windows.Storage.Pickers;
    #endif
    public class fileLoad : MonoBehaviour
    {

    #if ENABLE_WINMD_SUPPORT
    private FileOpenPicker openPicker;
    #endif
    void Start()
    {
    UnityEngine.Debug.LogFormat("UnityThread: {0}", Thread.CurrentThread.ManagedThreadId);
    #if ENABLE_WINMD_SUPPORT
    UnityEngine.WSA.Application.InvokeOnUIThread(OpenFileAsync, false);
    #else
    UnityEngine.Debug.Log("ENABLE_WINMD_SUPPORT false");
    #endif
    }
    but the result was always "ENABLE_WINMD_SUPPORT false".
    What can I do?
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    6,545
    Is it false on HoloLens or the editor?
     
  3. keng123

    keng123

    Joined:
    Apr 15, 2019
    Posts:
    3
    I made it run on Unity,then I got the result "false".So have no result on hololens
     
  4. keng123

    keng123

    Joined:
    Apr 15, 2019
    Posts:
    3
    I struggled for a long time, but I couldn't find a solution
     
  5. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    6,545
    ENABLE_WINMD_SUPPORT will always be false in the editor. It's only enabled when you build your game to UWP.
     
    HosseinArabbeigi likes this.