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

Looking for fast solution to use 9 slice on sprite renderer

Discussion in '2D' started by Sly88, Feb 27, 2020.

  1. Sly88

    Sly88

    Joined:
    Feb 22, 2016
    Posts:
    73
    hi guys,
    I'm looking for a new solution to handle 9 slices on sprite renderer. Now I use Draw Mode Sliced and I change size but I see a lot of performance drop in my game. I tested with scale and without and without works much faster.

    Added screenshots from a profiler. I reported a huge spike on PostLateUpdate.FinishFrameRendering() when I change size on Sprite Renderer.

    Do you know any solution?
     

    Attached Files:

  2. ChuanXin

    ChuanXin

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    1,068
    Could you share the geometry of the Sprite you are using for 9 slice? A wireframe image of the re-sized SpriteRenderer or the FrameDebugger draw step for the SpriteRenderer would be helpful too. It could be possible the re-sized SpriteRenderer has a lot of geometry.
     
  3. Sly88

    Sly88

    Joined:
    Feb 22, 2016
    Posts:
    73
    sure, it is simple png 14x14px
     

    Attached Files:

  4. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    434
    What is the size you are setting it to?
     
  5. Sly88

    Sly88

    Joined:
    Feb 22, 2016
    Posts:
    73
    it is random size from 0 - 1
     
  6. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    434
    Hi, we need a bit more information
    1. Which Unity version are you using by the way?
    2. Which player/platform is the profile from?
    3. Will it be possible to share the project?

    Thanks again!