Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Unable to Run webgl Component on localhost

Discussion in 'Web' started by abgamers, Aug 4, 2016.

  1. abgamers

    abgamers

    Joined:
    Dec 22, 2009
    Posts:
    97
    Hi,


    After upgrading to unity 5.4.0f3 my webgl builds are not working im getting following error

    I'm not sure what the problem is can anyone provide me with proper guidance

    Thanks in advance
     
  2. abgamers

    abgamers

    Joined:
    Dec 22, 2009
    Posts:
    97
    Anyone else facing the same problem??

    will be glad if anyone can guide me in the correct direction

    Thanks
     
  3. abgamers

    abgamers

    Joined:
    Dec 22, 2009
    Posts:
    97
    After debugging the code step by step in browser I found out the real reason for it to break.
    Issue was caused by following line of code
    Code (CSharp):
    1. System.GC.Collect(1);
    I'm not sure why the previous developer was playing around with garbage collection specially in update.

    If anyone finds them self facing the same problem make sure you are not performing any operation specially wrt GC.
     
  4. Ewanuk

    Ewanuk

    Joined:
    Jul 9, 2011
    Posts:
    257
    This fixed the same issue I was having. Thank you for posting your solution!

    Can someone from Unity explain why these calls are broken in 5.4.x? They were working in 5.3.5f1
     
  5. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    We only support zero as a parameter:
    System.GC.Collect(0);

    However, it is not supposed to crash. Would you mind submitting a bug report ?
     
  6. abgamers

    abgamers

    Joined:
    Dec 22, 2009
    Posts:
    97
    Hi Marco, as of now I cannot share the code base due to the product confidentiality bonds.

    If time permits, will see what i can do to reproduce it in some dummy project.

    Thanks for the help :)
     
  7. Ewanuk

    Ewanuk

    Joined:
    Jul 9, 2011
    Posts:
    257
    I can't for the same reason, also in crunch now and just don't have the time to do a full bug report with a stripped project.

    If it helps it was being called in a co-routine just after yield return new WaitForEndOfFrame(); and it was on a webGL build.

    We were also using GC.Collect(2);
     
  8. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    No worries, it was super easy to repro so I submitted one myself.