Author Topic: When XFrame downsampling is disabled XFrame creates 188kb of garbage per frame  (Read 504 times)

ashwinFEC

  • Newbie
  • *
  • Posts: 5
    • View Profile
When the Xframe Downsampling method is set to disabled the CheckCamera() will call the FindGameObject method twice every LateUpdate and generate unnecessary garbage of about 188kb. It's not that much but I think it's best to generate as little garbage as possible. Should probably only do the check if the downsampling method is different from the previous frame.

Code
  
      private void CheckCamera()
        {
            mainCamera = GetComponent<Camera>();

            if (xFrameCameraObj == null)
            {
                xFrameCameraObj = FindGameObject(XFRAME_CAMERA_INSTANCED);
                xFrameCamera = null;
            }

            if (xFrameBillboardObj == null)
            {
               
                xFrameBillboardObj = FindGameObject(XFRAME_BILLBOARD_INSTANCED);
            }

            ...
        }







Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 4736
    • View Profile
Thanks for reporting this and for the suggestion, will check this for a more efficient solution.
Note that the allocation produced by GetComponent call only occurs in Editor. In a build, GetComponent method does not allocate any memory. In any case Iíll review the issue here.
« Last Edit: May 24, 2018, 01:27:27 PM by Kronnect »

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 4736
    • View Profile
Yep, you're right! Fixed in latest beta and patch submitted to the Asset Store - thanks for the heads up!

ashwinFEC

  • Newbie
  • *
  • Posts: 5
    • View Profile
Thanks for the quick fix