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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Runtime Level Editor performance

Discussion in '2D' started by martin999b, Apr 13, 2015.

  1. martin999b

    martin999b

    Joined:
    Jul 14, 2013
    Posts:
    16
    I'm creating a tile based 2D level editor, going to be similar to what you can see in Broforce so the full level/terrain will build up from many "squares".

    I will need to modify these runtime (change sprites, destruct object, etc.)
    I started to implement this storing these tiles as prefabs in a two dimensional array, so I can easily grab and modify them runtime. My question: how will it affect performance? Is it safe to do this way or there is a better workaround for this? Thanks!
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Having every tile as a GameObject is a bad idea because you end up with zillions of objects (unless the levels are tiny), and the performance will be poor. You need to use as few objects as possible; the main methods I know of are 1) create meshes using the Mesh class, or 2) use an object pool.

    --Eric
     
  3. martin999b

    martin999b

    Joined:
    Jul 14, 2013
    Posts:
    16
    Thanks for your answer. I've tested the performance on my android device with more than enough tiles I need for one level and it ran flawlessly, and because my target platform is PC, I think I found my answer. :)