Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Fastest Settings for Drawing Textures ?

Discussion in '2D' started by rabirland, Aug 2, 2015.

  1. rabirland

    rabirland

    Joined:
    Nov 22, 2014
    Posts:
    29
    I have a little game, where I haveto deaw Texture2D objects... However, I do not use Unity's GameObject system rather I Draw them Manually with the GUI.DrawTexture... The reason for that that the Map is built from several Small object (Similar to Minecraft or Terraria) and Handling induvidial GameObject would end up handling Thousands of object... So I draw textures manually and only the amount that can be seen on the screen...
    Yet it is very, very slow... On my Android Tablet it is running so slow, but when I go away from the map (The small objects) it runs on normal speed... So is there a good way to get performace ?
    The textures i'm using are 512x512 and only a few gets rendered at a time, about 30-40 so it shouldn't be a problem for today's devices...
     
  2. sandboxed

    sandboxed

    Unity Technologies

    Joined:
    Apr 6, 2015
    Posts:
    95
    You could use the Mesh object, and add submeshes to it depending on your need.
    Each submesh will be an independent list of triangles, with its own material which can be set to use the texture you need.

    Checkout the Mesh api for setting up submeshes
    http://docs.unity3d.com/ScriptReference/Mesh.html
    http://docs.unity3d.com/ScriptReference/Mesh.SetTriangles.html and related api.

    If you are a pro customer, you can also checkout the preview of 2d Tilemap here (note that the builds here are for in-development features).