Search Unity

Discussion reduce editor garbage tricks

Discussion in 'Scripting' started by StarBornMoonBeam, May 8, 2023.

  1. StarBornMoonBeam

    StarBornMoonBeam

    Joined:
    Mar 26, 2023
    Posts:
    209
    Below is shown a 10,000 fps bat and ball lol
    BAT.gif

    Its made out of Rect Canvas Pixel Rect Science

    But the editor is simply too heavy for it!

    Ball.gif

    We average 4000, 10000 frames per second. There is some minor rendering in the background.

    But man does that editor tank. My FPS fluxuates 300FPS acknowledged on stats but editor steps in with chunks of heavy duty from time to time as i go about shrinking the bat and chasing the ball.

    I wonder if some kind of low processing mode can be invented. Or maybe if an inspector update can be toggled. OR wahat not I don't know.

    clearer.gif
    clearer show of FPS impact. it look like garbage spikes to me but its not my garbage so seems to be tucked into other section other garbage i imagine.
     
  2. Bunny83

    Bunny83

    Joined:
    Oct 18, 2010
    Posts:
    3,999
    Why do you speculate? Open the profiler....
     
    StarBornMoonBeam likes this.
  3. StarBornMoonBeam

    StarBornMoonBeam

    Joined:
    Mar 26, 2023
    Posts:
    209
    You know me bunny I am a dope

    Il see what I can find
     
  4. StarBornMoonBeam

    StarBornMoonBeam

    Joined:
    Mar 26, 2023
    Posts:
    209
    Just editor Loop
    EditorLoop.png

    It just means that I need to build that game for reliable playtest result. 4.3% player loop goes to Camera Render


    See the wave of garbage arrived Editor Loop.
    WAVE_OF_GARBAGE.png


    To invent a low garbage mode. I understand for many of my games I don't even notice. But 20ms its pretty huge in the context of. If my 10,000 code runs in 25ms, an extra 20ms here is almost double. It seems to be telling me that 20ms is the difference between 160fps and 60 on the bank. or rather, 10,000 fps squeezes down to maybe 60-120fps in 20ms.

    I guess the solution is to build test for smooth fps.

    It says GC allocate zero but still costs 20ms and it looks like a garbage wave. So it must be garbage.


    Even with camera off, and all objects inactive, Editor spikes are regular here. 10ms spikes and heavier waves break onto it.

    Would it be possible to invent a play button that disables ability to edit during test? and in fact disables the entire editor and focusses on a launch? and on exit of that window we re-activate editor? Possible?
     
    Last edited: May 9, 2023
  5. Bunny83

    Bunny83

    Joined:
    Oct 18, 2010
    Posts:
    3,999
    You do realise that you can expand those points in the profiler? When the garbage collector "collects" garbage it doesn't show up in the GC alloc column. As we can see the playerloop is allocating memory. So if the GC is causing those hicups, you should track down your GC allocs. Those will accumulate over time and have to be collected eventually.
     
  6. StarBornMoonBeam

    StarBornMoonBeam

    Joined:
    Mar 26, 2023
    Posts:
    209
    With more scutiny;

    It looks like when I pause the editor for a few seconds, and resume play, I create a wave of editor activity.

    pause.png


    here with nothing in hierarchy active
    nothing_on.png

    Editor Connection. Poll All Custom Messages
    Editor Connection Check for Incoming Connections

    oh here is asome info
    Unity - Scripting API: EditorConnection (unity3d.com)
    In theory I can destroy the instance for editor to check for player hm
    I will attempt.
    Code (CSharp):
    1.   if (EditorConnection.instance != null)
    2.             Destroy(EditorConnection.instance);
    This one
    Unity - Scripting API: PollPlayerConnection (unity3d.com)
    as far as it can go, i'd have to remove the editor connection scripts and modify the editor i guess
     
    Last edited: May 9, 2023
  7. StarBornMoonBeam

    StarBornMoonBeam

    Joined:
    Mar 26, 2023
    Posts:
    209
    Not to worry, it can get stable fast FPS while not looking at the profiler : )
    I hope it lasts

    nice_stability.gif
     
    Last edited: May 9, 2023
  8. StarBornMoonBeam

    StarBornMoonBeam

    Joined:
    Mar 26, 2023
    Posts:
    209
    Balls.gif

    Having the Scene Camera closed works aswell.

    But the problem fluctuates. Causes slow motion effect. Not a problem anyway. Just the editor is too havy