Search Unity

[SOLVED]Sprites loaded at runtime wont batch

Discussion in '2D' started by Shaka, Mar 26, 2017.

  1. Shaka

    Shaka

    Joined:
    Apr 24, 2010
    Posts:
    51
    Hi!

    I don't know if this is supposed to work or if I'm doing something wrong, but I'm creating a texture atlas at runtime from a bunch of textures loaded from disk.

    Using Sprite.Create with the atlas and a rect specified in a xml I then create a list of sprites that is kept in memory. The problem is that when I instantiate gameobjects using any of the sprites they produce one draw call each.
    Is dynamic batching supposed to work when loading sprites at runtime or am I doing something wrong here?

    Regards/Per
     
  2. Shaka

    Shaka

    Joined:
    Apr 24, 2010
    Posts:
    51
    Solved. It does indeed work. Some wonky linq-action on my part created multiple texture atlases :)