Search Unity

Trouble Loading from Streaming Assets Upon Build (Windows)

Discussion in 'Editor & General Support' started by Labecki, Mar 16, 2019.

  1. Labecki

    Labecki

    Joined:
    Apr 14, 2015
    Posts:
    17
    Hello,

    I have been trying to get a Windows build of the current state of my game to run correctly, but the data files from Steaming Assets do not seem to be loading (and are probably generating an error that prevents other initialization methods from running).

    Of course, there has been no such problem when playing the game from within the Unity Editor.
    This is how I am attempting to access the folders in Streaming Assets:

    Code (CSharp):
    1.  
    2.          string sa = Application.streamingAssetsPath;
    3.          string nationsPath = sa + "/Scenarios/" + scenario + "/Nations";
    4.          string[] nationFiles = Directory.GetFiles(nationsPath, "*.json");
    5.  

    In desperation, I even tried keeping the .json files in Assets and accessing them from there, but that did not help either.
    Can anyone suggest to me what I am doing wrong here?
     
  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,443
  3. Labecki

    Labecki

    Joined:
    Apr 14, 2015
    Posts:
    17
    Thank you mgear. Previously, I was trying to find some kind of log in the build files and, of course, found nothing.
    So this is what I found:
    Code (CSharp):
    1. PlatformNotSupportedException: Operation is not supported on this platform.
    2.   at Newtonsoft.Json.Utilities.DynamicReflectionDelegateFactory.CreateDynamicMethod (System.String name, System.Type returnType, System.Type[] parameterTypes, System.Type owner) [0x00018] in <97722d3abc9f4cf69f9e21e6770081b3>:0
    3.   at Newtonsoft.Json.Utilities.DynamicReflectionDelegateFactory.CreateDefaultConstructor[T] (System.Type type) [0x00010] in <97722d3abc9f4cf69f9e21e6770081b3>:0
    4.   at Newtonsoft.Json.Serialization.DefaultContractResolver.GetDefaultCreator (System.Type createdType) [0x00005] in <97722d3abc9f4cf69f9e21e6770081b3>:0
    5.   at Newtonsoft.Json.Serialization.DefaultContractResolver.InitializeContract (Newtonsoft.Json.Serialization.JsonContract contract) [0x00093] in <97722d3abc9f4cf69f9e21e6770081b3>:0
    6.   at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateObjectContract (System.Type objectType) [0x00007] in <97722d3abc9f4cf69f9e21e6770081b3>:0
    7.   at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateContract (System.Type objectType) [0x000e1] in <97722d3abc9f4cf69f9e21e6770081b3>:0
    8.   at Newtonsoft.Json.Serialization.DefaultContractResolver.ResolveContract (System.Type type) [0x00038] in <97722d3abc9f4cf69f9e21e6770081b3>:0
    9.   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.GetContractSafe (System.Type type) [0x00005] in <97722d3abc9f4cf69f9e21e6770081b3>:0
    10.   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType, System.Boolean checkAdditionalContent) [0x0000e] in <97722d3abc9f4cf69f9e21e6770081b3>:0
    11.   at Newtonsoft.Json.JsonSerializer.DeserializeInternal (Newtonsoft.Json.JsonReader reader, System.Type objectType) [0x00053] in <97722d3abc9f4cf69f9e21e6770081b3>:0
    12.   at Newtonsoft.Json.JsonSerializer.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType) [0x00000] in <97722d3abc9f4cf69f9e21e6770081b3>:0
    13.   at Newtonsoft.Json.JsonConvert.DeserializeObject (System.String value, System.Type type, Newtonsoft.Json.JsonSerializerSettings settings) [0x0002d] in <97722d3abc9f4cf69f9e21e6770081b3>:0
    14.   at Newtonsoft.Json.JsonConvert.DeserializeObject[T] (System.String value, Newtonsoft.Json.JsonSerializerSettings settings) [0x00000] in <97722d3abc9f4cf69f9e21e6770081b3>:0
    15.   at Newtonsoft.Json.JsonConvert.DeserializeObject[T] (System.String value) [0x00000] in <97722d3abc9f4cf69f9e21e6770081b3>:0
    16.   at AssemblyCSharp.PopulateNationDropdown.CreateScenarioList () [0x0001e] in <62e40c1f957f4ccab810c3f9e30e390c>:0
    17.   at AssemblyCSharp.PopulateNationDropdown.Start () [0x00075] in <62e40c1f957f4ccab810c3f9e30e390c>:0
    In addition to this, there were numerous
    Code (CSharp):
    1. Material AddUI doesn't have _Stencil property
    errors, which might also be causing trouble.
     
  4. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,443
    Labecki likes this.
  5. Labecki

    Labecki

    Joined:
    Apr 14, 2015
    Posts:
    17
    My problem turned out to be precisely the same as in the links you gave.
    Thanks so much mgear, I owe you one!