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. Dismiss Notice

Weird behavior in the profiler (or Android player, i don't know).

Discussion in '2018.1 Beta' started by georgeq, Apr 5, 2018.

  1. georgeq

    georgeq

    Joined:
    Mar 5, 2014
    Posts:
    660
    I'm profiling my project on an Android device with 2018.1.0b13 because I'm getting a very poor performance, and there are few things that call my attention.

    perfomw.png

    First, I'm 100% sure I am not using FindObjectsOfType anywhere on my code, actually I've never used that function since I started with Unity 4 years ago. Second I'm not using any files, so why on earth does the player needs to open a file, maybe the player itself has a reason for that, but if that's the case; why to open a file in the middle of the game play instead of doing it at startup?

    There's also something within the rendering pipeline that is affecting the way the profiler shows the graph, if I use the standard rendering pipleline a get this:

    performsrp.png

    But if I use the Lightweight rendering pipeline I get this:

    performlwrp.png

    Performance is actually worse with the LWRP (I still don't know why), however not as much as the profiler tells. As a matter of fact everything seems to take longer when using this pipeline, if you compare the two graphics it seems like everything took twice as much, I can't tell for sure, but it looks like something is changing the scale of the graph, making it look like the game is performing much slower that it actually does.
     
  2. SebastianHjorth

    SebastianHjorth

    Unity Technologies

    Joined:
    Feb 13, 2018
    Posts:
    6
    Hi!
    FindObjectsOfType can be called from our internal API. Note that it is not FindObjectsOfType taking up 2 seconds of execution time, but it simply the last sample we received before going into an area that is not covered by the profiler. However, external instrumentation tools might be able to tell you what is going on as they do not rely on markers.
    For the File.Open sample, you should be able to see which file was opened if you switch to timeline view and find the same there in. You can do this quickly by selecting the sample in hierarchy view and then switching to timeline with it still selected. You can now hover the mouse of the sample to see the associated metadata(in this case a file name).
     
    Peter77 likes this.
  3. gintautass

    gintautass

    QA Minion Unity Technologies

    Joined:
    Oct 27, 2015
    Posts:
    46
    To add to what @SebastianHjorth said:
    For unaccounted profiler sample please file a bug with project and repro steps and attach saved profiler data. We will look into it and add the missing profiler samples.

    And another bug report for the performance difference between LWRP and standard rendering pipelines.
     
    Peter77 likes this.