Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

FPS Drop when I set the GameObject Layer

Discussion in '2018.3 Beta' started by RGSMS, Oct 16, 2018.

  1. RGSMS

    RGSMS

    Joined:
    Jan 15, 2014
    Posts:
    2
    Hi everyone, I need some help, Please.

    First then all, I'm using the current beta version (2018.3.0b5), because I need Nested Prefabs.

    The problem is: My game is working very well, I have no FPS drop, but when I try to set a gameobject layer I lost a bunch of frames.

    Here is the Code:

    Code (CSharp):
    1. private IEnumerator GoUp (float velocity)
    2.         {
    3.             vehicle = PreviousBlock.vehicle;
    4.  
    5.             if (m_command != COMMAND.NONE)
    6.             {
    7.                 if (vehicle != null)
    8.                 {
    9.                     //m_buttonRenderer.gameObject.layer = vehicle.joystickID + 13;
    10.                     Game.Instance.SetNewFixedUpdate(CustomFixedUpdate);
    11.                 }
    12.             }
    13.  
    14.             if (m_itemBox != null)
    15.             {
    16.                 m_itemBox.Active();
    17.             }
    18.  
    19.             int count = m_renderes.Length;
    20.             for (int i = 0; i < count; i++)
    21.             {
    22.                 m_renderes[i].enabled = true;
    23.             }
    24.  
    25.             float lerp = 0.0f;
    26.  
    27.             while (lerp < 1.0f)
    28.             {
    29.                 lerp += Game.DELTA_TIME * velocity;
    30.  
    31.                 transform.localPosition = Vector3.Lerp(m_offPosition, m_onPosition, lerp);
    32.              
    33.                 yield return null;
    34.             }
    35.  
    36.             moment = MOMENT.STOPPED_UP;
    37.             m_trail.activedBlocks++;
    38.         }
    I'm doing it at 12 cubes, in different moments, its not on a heavy update or something like it. Without the line my game is working great, but with it the game cannot be played.

    Someone knows what could be happening?

    Here is some Gifs:

    Normal:
    https://www.dropbox.com/s/w8ukde0ouft54c8/noFPSdrop.gif?dl=0

    FPS drop:
    https://www.dropbox.com/s/6t5pypbm9k1vq7b/FPSdrop.gif?dl=0
     
  2. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,610
    LeonhardP likes this.