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

Are reason why reflexion might not be working on WebGL build

Discussion in 'Web' started by fwalkerCirca, Feb 23, 2018.

  1. fwalkerCirca

    fwalkerCirca

    Joined:
    Apr 10, 2017
    Posts:
    57
    I believe this is a build setting issue but I can not figure out which one. My webGL build fails at line:

    MethodInfo method = typeof(JsonUtility).GetMethod("FromJson", new Type[] { typeof(string) });

    But this line not only works fine in the Editor build, but also in another project where I use the same code !!! :( In the same way....

    I cannot for the life of me figure this out. Does anyone have a hint on what I might be missing. The error in WebGL as usual is not particularly helpful:
    "Invalid function pointer called with signature 'iii'. Perhaps this is an invalid value"
     
  2. samizzo

    samizzo

    Joined:
    Sep 7, 2011
    Posts:
    487
    It sounds like it could be a stripping bug. Is there anything else in the error logs? Are you able to reproduce it in a minimal project? If so you should report a bug.

    -Sam
     
  3. Schubkraft

    Schubkraft

    Unity Technologies

    Joined:
    Dec 3, 2012
    Posts:
    1,070
  4. samizzo

    samizzo

    Joined:
    Sep 7, 2011
    Posts:
    487
    But he's not using dynamic code generation, he's just using type information to look up a method. That should work, shouldn't it?

    -Sam
     
    Last edited: Feb 26, 2018
  5. fwalkerCirca

    fwalkerCirca

    Joined:
    Apr 10, 2017
    Posts:
    57
    It does work on a different project. There is something about the setting. But I have yet to figure it out.
     
  6. kwcae

    kwcae

    Joined:
    May 26, 2017
    Posts:
    34
    IT may be beneficial to elaborate on the System.Reflection.Emit entry to that page now as most newcomers won't directly add a sing statement for it but may still find that their code inadvertently uses it in some unforseen way. This becomes especially true now that .Net 4.x is supported as it adds dynamic variable types which end up using Reflection.Emit behind the scenes and run afoul of AOT.