Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

WebGL template code does not match browser debugger code

Discussion in 'WebGL' started by T0RED, Jul 22, 2022.

  1. T0RED

    T0RED

    Joined:
    Oct 3, 2018
    Posts:
    6
    Hi all, I have the following problem after following steps:

    1) I change the index.html in my WebGL template.
    2) Build the WebGL project with selected template.
    3) With the finished build I start an Apache server.

    -> My problem now is that the changes I made in 1) are not visible in the debugger of the browser and you only see the old index.html there. However, if I simply select "Build and Run" via Unity, then everything works and the changes from 1) are also applied.

    Does anyone have an idea which would explain this behavior?
     
  2. unityruba

    unityruba

    Unity Technologies

    Joined:
    Nov 6, 2020
    Posts:
    235
    @T0RED Are you refreshing the same webpage after re-starting the server? A lot of the time browsers cache old files, could you try clearing your browser's cache and seeing if the changes show up? (on Chrome, you can right-click on the refresh button and click "Empty Cache and Hard Reload")
     
    Last edited: Jul 22, 2022
  3. T0RED

    T0RED

    Joined:
    Oct 3, 2018
    Posts:
    6
    @unityruba Thank you very much for your answer.

    That is not the reason. I have cleaned all caches and still I have different code in the browser debugger than in the template.

    Overall I have the following original error:
    - When I run "build and run" in Unity, everything runs like a charm.
    - But when I start the built project (previously run "build"), via an Apache web server and not via the Unity development environment. Then I get error messages because of the html file. This is also the reason why I really want to have the html file changed, because I want to get this running on the Apache server.

    Just a naive question to be sure:
    If I want to change the web page that the WebGL application is running on, then I do need to change the html file from the WebGL template if I am using a custom WebGL template, right?
     
  4. unityruba

    unityruba

    Unity Technologies

    Joined:
    Nov 6, 2020
    Posts:
    235
    what errors are you getting?

    you would change the html file in the custom template folder you added under your project's Assets/WebGLTemplates folder, or the html file under the specific build folder.
     
  5. unityruba

    unityruba

    Unity Technologies

    Joined:
    Nov 6, 2020
    Posts:
    235
    For what it's worth, I run a local http-server to test my builds, and if I change my index.html file, I have to either restart the server or refresh the webpage to see my changes.