Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Migrating from Unity 2018.4 to 2019.4 problems

Discussion in 'Web' started by GustavNinja, Nov 14, 2020.

  1. GustavNinja

    GustavNinja

    Joined:
    Jun 13, 2016
    Posts:
    91
    Hi I'm currently in trying to get my game updated to the latest Unity Engine LTS version but I've stumbled upon some weird changes that I'm having trouble finding a good solution on so I was hoping if someone can help me out.

    Engine change 2018.4.16f1 -> 2019.4.14f1

    1. "touken.wasm.code.unityweb" build path code has changed?
    This file is in the build located in the Build folder when built but in my project we support several languages and is built into different folders. So when loaded the file on the server it goes from a specific path to a different path.
    www.someurl.com/webgl/language/version/{files}
    becomes
    www.someurl.com/webgl/Build/{files}

    Other files like dataUrl or wasmFrameworkUrl gets the correct path. For me to fix this problem I changed the current locateFile function in UnityLoader.js to this.
    Code (JavaScript):
    1.  
    2. locateFile: function(url) {
    3.     return this.resolveBuildUrl("").concat(url == "build.wasm" ? this.wasmCodeUrl : url);
    4. },
    5.  
    I don't know if this might be a bug or not but I can fix this with a pretty easy file swap if needed.

    2. *Resolved* Resolution is doubled from Default Canvas Width & Height
    I don't know if this is because of me being on a Macbook Pro or not but. When I enter the game the resolution settings is doubled.
    My initial settings are 1030x580 but when entering the game they get set to 2060X1160.
    I have tried to change the resolution in code but it only starts to work like 2 or 3 frames since the game has started. But in doing so the mouse click location also gets reduced to 1/4 of the screen since but the correct resolution size is changed.
    Code (CSharp):
    1. Screen.SetResolution(1030, 580, false);
    * I fixed this problem after viewing this page.
    https://forum.unity.com/threads/webgl-retina-scaling.853144/
    I just needed to add
    Code (JavaScript):
    1. "devicePixelRatio":1
    to the json file to get it to work.

    I hope that someone might have any good answers for me and I await your replies.
     
    Last edited: Nov 15, 2020
  2. GustavNinja

    GustavNinja

    Joined:
    Jun 13, 2016
    Posts:
    91