Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Error Building Player

Discussion in 'Unity 5 Pre-order Beta' started by Lorin, Oct 29, 2014.

  1. Lorin

    Lorin

    Joined:
    Feb 13, 2014
    Posts:
    5
    I am down to one error left in my attempt to build my project in WebGL. I am a game designer and artist with limited programming skills. (I usually call my son for the programming and scripting work) I want to try and fix this one myself. Unfortunately I do not know exactly what this error is telling me.

    Error building Player: Win32Exception: ApplicationName='"D:\Program Files\Unity 5.0.0b9\Editor\Data\PlaybackEngines\webglsupport/BuildTools/Emscripten_Win/python/2.7.5.3_64bit/python.exe"', CommandLine='"D:\Program Files\Unity 5.0.0b9\Editor\Data\PlaybackEngines\webglsupport/BuildTools/Emscripten/emcc" -Oz -s NO_EXIT_RUNTIME=1 -o "D:/Users/Lorin/New Unity Project-50/Assets/../Temp/StagingArea/Data\Native\UserAssembly.bc" @"C:\Users\Lorin\AppData\Local\Temp\tmp2fe0f3e9.tmp"', CurrentDirectory='D:/Users/Lorin/New Unity Project-50/Assets/../Temp/EmscriptenWork'

    Can someone help me on this?
     
  2. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,931
    Unfortunately we can't tell too much about the specific problem from this error. Can you submit a bug and include the project in the bug report? Please reply here with the bug number, and we will have a look at the problem. Thanks.
     
  3. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,931
    It looks like the bug submitted is 643763. I've been able to reproduce the problem with the project provided, thanks! I'll investigate its cause.
     
  4. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,931
    I've tracked down the cause of this problem. It is actually related to the code in the Joystick class in the Assets/JoyStick/Scripts directory. Specifically, the Joystick class overrides the OnValidate of MonoBehavior:

    Code (CSharp):
    1. protected override void OnValidate()
    2. {
    3.     base.OnValidate();
    4.     UpdateJoystickGraphic();
    5. }
    However, OnValidate is only called in the editor:

    http://docs.unity3d.com/460/Documentation/ScriptReference/MonoBehaviour.OnValidate.html

    Normally, this is not a problem. I can build a standalone player without errors, and the Joystick.OnValidate method simply won't be called in the player. However, for the WebGL build, we strip out unused methods to decrease the size of the final build. So the MonoBehaviour.OnValidate method is gone, and this error occurs.

    You can correct this in your project by changing the code in Joystick.cs to be:

    Code (CSharp):
    1.  
    2. #if UNITY_EDITOR
    3. protected override void OnValidate()
    4. {
    5.     base.OnValidate();
    6.     UpdateJoystickGraphic();
    7. }
    8. #endif
    9.  
    Note that the error message Unity reports in this case is not good, since it does not mention that Joystick.OnValidate is the cause of the problem! I'll make a change to improve the error message as well.
     
  5. Lorin

    Lorin

    Joined:
    Feb 13, 2014
    Posts:
    5
    Thanks for the reply however, I do not have the joystick.cs script in my project unless it is part of the engine and I simply can't find it. And as some added information about the error. I built an empty project with only the standard assets, placed a plane and a box in the scene. I then attempted to build to WebGL again and get the exact same error. Leaves me to believe that maybe something on my PC, not the game engine or project that is causing this. I am going to try it on my other PC at home to test my theory. Thanks again for helping with this.
     
  6. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,931
    The script file I was referring to is named Joystick.cs and it is located in the Assets/JoyStick/Scripts directory in the project that was submitted with the bug. If you can located that file and make the change I mentioned above, the project should build with WebGL correctly. At least, the project submitted with the bug built correctly when I made that change.

    Please reply here if you find that something else is causing a problem. It may be true that you have some setting on your computer that I cannot reproduce here. Thanks.