Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Have you been using the Profiler ?

Discussion in 'WebGL' started by Marco-Trivellato, Oct 30, 2015.

  1. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    Hi,

    I'd like to collect some feedback about the Profiler on WebGL, since occasionally people seem to run into problems.
    The Unity Profiler works on WebGL, like on the other platforms, but there are a few things to be aware of (from our Manual):
    The simplest way to profile is to check “Autoconnect Profiler”, then select "Build and Run".

    Though that's not the only option: you can also Profile previously built WebGL content but, be aware that, this only works if you already deployed for WebGL since you started Unity.
    In addition, we should mention that the Profiler might not work properly if there is a "zombie" unity process still running from a previous session. So, if you run into issues in trying to use the Profiler, try to close Unity, make sure there are no more Unity processes running (for example, using Task Manager on Windows), then restart Unity.

    These are just a couple of things to be aware of. So, have you been using the Profiler ? Has it been working fine ?
     
  2. bigbadtrumpet125

    bigbadtrumpet125

    Joined:
    Apr 1, 2013
    Posts:
    18
    I have used a few times. Haven't tried any sort of connecting outside of Build And Run with auto connect turned on. Was able to successfully able to debug on a different computer (and os) than was running unity which was super awesome and unexpected (just had my local server running on the unity machine and then connected locally from a separate computer)

    Two issues I've had was it would pop up the unresponsive script almost anytime I switched to and from the web browser and unity (if I clicked wait it would tend to clear up and keep running) and chrome didn't connect and work near as frequently as Firefox did.

    Hope this helps!
     
  3. BenJones

    BenJones

    Joined:
    Dec 14, 2012
    Posts:
    11
    I have primarily been using it just to figure out how much memory to allocate, if my interactive was more complicated I'd probably use the profiler to figure out is expensive.

    I typically hit build then go do something else then come back and open the local html page in firefox and test it out. I'll have to try out Build and Run though.

    I get the same message bigbadtrumpet125 mentioned, not really an issue for me since it's a dev build, but I could see the interruption being annoying for some types of testing.

    Edit:
    Just tried out build and run and since Chrome is my default browser it opened up in Chrome and did nothing, since Chrome doesn't like local Unity WebGL apps. It'd be nice if you could choose your browser for Build and Run.
     
    Last edited: Oct 31, 2015
  4. Zenix

    Zenix

    Joined:
    Nov 9, 2009
    Posts:
    210
    Managed to get it to connect a couple of times, but Unity would always lock up if you left it on for more than ~15 seconds.
    Usually it won't connect at all.
     
  5. levwsr

    levwsr

    Joined:
    Jul 23, 2012
    Posts:
    67
    Hey @Marco Trivellato:
    We cant get this working in any useful way. Our app is a facebook canvas app, which we have to hack around, but then beyond that loading a dev build of our code results in a gigantic, unstable monster for the browser. Add on the profiler, and i think its laughable.

    What would be a better use of time, in my opinion, would be some sort of api calls we could make to get the 'state of the union' re allocations. Something like what you see in the simple version of the profiler, but that works in webgl release builds. Something that is also aware of our hard-cap to memory.. so for example if we ask for 200mbs how much of that is left, whats the max allocation size, and whatnot. Even just some basic information would be invaluable.
     
  6. levwsr

    levwsr

    Joined:
    Jul 23, 2012
    Posts:
    67

    https://www.dropbox.com/s/0oetu2l190771fo/MemCap.png?dl=0
    Not sure if this image will post, but if it does its a profile output of our game right when we run out of memory. Only, its not clear why we ran out.. We've set our build to use 175MB in WebGl, and its not clear what here is adding up to more than that.
     
  7. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    I don't think it's a problem of the profiler, do you mind re-posting in a new thread and we will take it from there ?
     
  8. diekeure

    diekeure

    Joined:
    Jan 25, 2013
    Posts:
    219
    I've been using the profiler this afternoon at work, no problem at all. But now back home, same pc, I get this error:

    Firefox can't establish a connection to the server at ws://10.0.3.20:54998/.

    The 10.0.3.20 ip adres is my adres at work, but at home I have an ip address that looks like 192.168.2.x..

    Is that ip adres saved somewhere? I tried creating a new build, but that didn't helpt...
     
  9. diekeure

    diekeure

    Joined:
    Jan 25, 2013
    Posts:
    219
    Ok, my bad, I was looking at the wrong build after all. With a build made at home it now works.

    But if I understand correctly: for the profiler to work, you need to run the build on a machine with same ip address as when you made the build. It is not possible to have a buildserver create a build and profile that on your own pc. Correct?
     
  10. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,635
    Almost correct. You can run the build on any machine in the network, but you need to run the *editor* on a machine with same ip address as when you made the build.
     
  11. cogentEd

    cogentEd

    Joined:
    Aug 3, 2015
    Posts:
    6
    In case anyone tries, changing the IP address in yourBuild/Development/yourBuild.data doesn't work. :confused:
     
  12. coolraiman

    coolraiman

    Joined:
    Oct 20, 2013
    Posts:
    9
    i only used it on local with firefox 32 bit
    work well but seems to freeze and unfreeze. Sometimes a popup say i have a script error, i press continue and everything work fine.
    The browser seems to freeze more often when the game does not have the focus (run in background is on) but in general, nothing major.
    I mostly use it to know the ram needed.
    For performance, i prefer to use a fps counter Dev build are not a real representation of the actual performance.
    But the profiler still help to know where to optimize, if the processor is waiting for the gpu or vice versa and etc...

    strange thing, i tested the profiler again while typing this answer for the first time in almost a month and i had 0 freeze.
    i use the same version of unity as when i started my project. 5.3.1f1
    my firefox version is 45.0.1
    i had a lot of optimization on my side but i bet the firefox version is for something.

    EDIT
    Using build and run for chrome with the profiler, the game load and start but after 5-10 frame, everything stop and chrome ask me to kill or wait the page
     
  13. Eric-Laberge

    Eric-Laberge

    Joined:
    Jan 20, 2011
    Posts:
    26
    A few quirks about the profiler:
    - As you already noted, the profiler does not work unless one makes a new build. That makes it impractical to use other tools that rely on the profiler, such as the experimental memory profiler, where I have to make a dummy build of that project before launching my main project.
    - It does not work when running under an encrypted protocol (HTTPS). It is obvious why when one finds out about the browser security policies, but it would be helpful if there was some warning about that.

    Otherwise, it is a valuable part of our development process.
     
  14. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,443
    I wasn't able to get the profiler to work.

    Our game is built to be used on Facebook. We cannot run it outside the context of Facebook.
    Instead of building & uploading the game to S3 (where we store the build), we have a little "trick" where we tell Facebook that the build is at somegameurl.com. Locally, we redirect (via hosts file) this host to 127.0.0.1.

    This technique allows our team to produce new builds and use them immediately without having to waste time uploading them.

    the issue with profiling is that the game attempts to contact the the machine's IP via websockets (ws:// protocol). This fails when running the game in this context, since this IP (or even protocol?) is not supported due to security measures, so we are not able to profile our builds...

    Is there any easy way to avoid this?
     
  15. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,635
    @liortal: my guess what may be going on: You are hosting the page in an encrypted https context. For consistent security, the browser would then require the profiler connection to also be encrypted, so it would have to be wss:// instead of ws://. However, websockify.js, which we use for the ws<->editor bridge for the profiler connection does not support wss. So I don't see an easy way to fix this (if this is indeed the reason).
     
  16. arumiat

    arumiat

    Joined:
    Apr 26, 2014
    Posts:
    318
  17. arumiat

    arumiat

    Joined:
    Apr 26, 2014
    Posts:
    318
  18. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    Yes. Though we may be able to add GPU profiling support in a future release.
     
    arumiat likes this.
  19. arumiat

    arumiat

    Joined:
    Apr 26, 2014
    Posts:
    318
    Any tips for profiling with the GPU then? Should the Editor GPU give you a pretty good idea of bottlenecks?
     
  20. hromoyDron

    hromoyDron

    Joined:
    Jan 24, 2013
    Posts:
    83
    Hello!

    Trying to use profiler.

    What I do:
    1. Check - development build
    2. Check - autoconnect profiler
    3. Build WebGl on my mac

    4. Load this build to gamejolt.com
    5. Check that it would be http (no https)
    6. Run my game on gamejolt.com from my mac through Chrome
    (unity has already been running and profiler window is open)

    7. In Chrome console I get this message:
    "WebSocket connection to 'ws://192.168.0.12:54998/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED"

    What I do wrong?
     
  21. dforstmaier

    dforstmaier

    Joined:
    Oct 5, 2016
    Posts:
    3
    Hello,

    it's been more than two years now since the last post concerning the topic. Is there any progress to be expect?

    A working profiler could really help me right now, but most of the mentioned problems seem to be still an issue (2018.1.1f1).

    With all the things you have to keep in mind it took me a whole day to get any connection to a profiler - it would be very helpful if the Unity Documentiation (e.g. the Debugging and trouble shooting WebGL builds chapter) also covers the points mentioned here in this thread, like:
    • "be aware that, this only works if you already deployed for WebGL since you started Unity."
    • "Though we may be able to add GPU profiling support in a future release." (I thought I read it somewhere, but I cant find it right now in the webgl chapters)
    • "You can run the build on any machine in the network, but you need to run the *editor* on a machine with same ip address as when you made the build."
    • "However, websockify.js, which we use for the ws<->editor bridge for the profiler connection does not support wss. So I don't see an easy way to fix this (if this is indeed the reason)."

    But unfortunately the very worst thing is, that even if you manage to get any connection it only lasts for a few seconds - at least in our project and even by keeping the focus the whole time. Also you dont get any kind of error or warning, it just stops working and you have no chance of identifiying your problem.
    If the connection cant be made reliable and stable in the most projects, all efforts are a waste of time. Correct me if I'm wrong, but I can't read anywhere that this issue is also being tackled and of major concern? A lot of people complained about it, even in this thread, but I can't see a response to those.

    With player building times about 15-30min it's even more important that the profiler is becoming somewhat useful, but right now it still seems far away from that status, unfortunately.
     
  22. nsmith1024

    nsmith1024

    Joined:
    Mar 18, 2014
    Posts:
    813
    Can the profiler help me find out how to fix my problem of the game freezing during download of photos from the internet?
     
unityunity