Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Question Huge fps drop with UnityWebRequest.GetTexture

Discussion in 'Multiplayer' started by SassyPantsy, Feb 13, 2023.

  1. SassyPantsy


    May 17, 2020
    Hi all,
    I'm not building a multiplayer system or anything, but I figured this will be the best place to ask around in.

    I have a few menus that use UnityWebRequest.GetTexture and UnityWebRequest quite often, to download images and text from a server (that currently runs locally). I've noticed a really big FPS drop when I call UnityWebRequest.GetTexture. Its basically a good 1-2 second screen freeze (depending on the image size).

    The flow is that a System.URIi is created from a url string -> WebRequest is sent -> a texture's returned -> A sprite is created from that texture -> that sprite's assigned to an image container.

    I don't mind not having an image until it finishes loading, but I just don't want my game to freeze.

    I'm guessing the drop might actually happen when I create the sprite and not when the request is sent/returned, but either way I'm not so sure how could I optimize it.
    Anyone knows any good practice for this flow? Or at least what am I doing wrong?

    BTW, I have an amd R9 5900x and an R9 290 GPU with 16Gb 3600mhz ram