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

Split layer to edit each object seperately

Discussion in 'Editor & General Support' started by kon3dos, Jun 2, 2018.

  1. kon3dos

    kon3dos

    Joined:
    Jun 2, 2018
    Posts:
    1
    Hey everyone! I am new to Unity and this is my first post here.

    I imported an .obj file into my project. The file is taken from OpenStreetMap using OSM2World program, in order to have a 3D city.

    The file consists of several layers (Forest, Road, Building etc).

    What I wanna do is split the 'Building' layer into more layers, one for each building. The reason I wanna do it is so that I can edit each splitting (for example, apply different colors/textures to each building).

    As you see in the attached picture, when I choose the 'Building' layer, all buildings are selected.

    Any ideas? How can I edit each building separately or split the 'Building' layer?
     

    Attached Files:

  2. 1Piotrek1

    1Piotrek1

    Joined:
    Mar 14, 2014
    Posts:
    130
    If you're just a beginner the best option for you would be to use a 3d modelling program, here's how it can be done in blender: link

    If you want to do this in unity, start reading the documentation of Mesh class.
    Steps would be something like:
    1. Create empty mesh.
    2. Select first triangle of the original mesh, copy the triangle and it's vertices to the new mesh.
    3. Search for all triangles that share it's vertices, copy them to the new mesh.
    4. For each of these triangles do the step 3.
    5. Remove found triangles from the original mesh.
    6. Go to step 2.
    It would be a nice introduction to mesh manipulation for you, but if it's just a one time thing I don't think that it's worth the effort.