Search Unity

Custom port for localhost:

Discussion in 'Web' started by ikimas, Apr 6, 2021.

  1. ikimas

    ikimas

    Joined:
    Mar 30, 2018
    Posts:
    1
    do u know how to set custom port for Unity/WebGL? beacose i can't open my project from other devices on website in localhost beacose i need to be connected to port 8080
    I would be very thankful
     
  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,436
    can run it manually from commandline with:

    "C:/Program Files/Unity2019_4/Editor/Data/MonoBleedingEdge/bin/mono.exe" "C:/Program Files/Unity2019_4/Editor/Data/PlaybackEngines/WebGLSupport/BuildTools/SimpleWebServer.exe" "X:/YourFolder/YourProject/Builds" 60606

    info
    https://unitycoder.com/blog/2021/03/11/run-webgl-server-manually/

    or if you need to host it on your pc, would be easier to install those web servers, like Xampp,
    to have it always running.
     
    KamilCSPS likes this.
  3. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    I wrote a blog post on how to setup IIS and Unity WebGL on your computer.
    In these steps you can set the port.
     
    KamilCSPS likes this.
  4. KamilCSPS

    KamilCSPS

    Joined:
    May 21, 2020
    Posts:
    448
    Only thing missing is the steps to enable BR/GZip compression and it's pretty complete. Good Job!
     
    Meltdown likes this.
  5. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    Well this is for localhost only, I'm guessing if setting up a server then it would be important. Otherwise it works fine without the compression locally.
     
  6. KamilCSPS

    KamilCSPS

    Joined:
    May 21, 2020
    Posts:
    448
    True. However, I do find it useful test compression locally as well to verify loading times, build sizes, download times (emulated), web caching handling.
     
    Meltdown likes this.