Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

240
Vistas
Unity : From large image to map / terrain / texture

In Unity, I'd like to generate 2D map from a large image file (965012573). I already have a tile/image pieces generator but it generates 1900 images 256256, and it seems hard to create a map by hand like this (and I have more then one large image to process...).

These image pieces are sorted like this :

x/y.png

Where x starts from left to right and y from top to bottom.

As MelvMay suggests me here, I should use textures to achieve that, but how?

Do you have any idea of how to achieve that programmatically? Or may be with an existing bundle?

Thanks a lot!

[edit] As a workaround, I tried this :

public class MapGenerator : MonoBehaviour {
    
    private Renderer m_Renderer;
    private Texture2D m_MainTexture;

    // Use this for initialization
    void Start () {

        //Fetch the Renderer from the GameObject
        m_Renderer = GetComponent<Renderer> ();
        m_MainTexture = LoadPNG("Assets/Tiles/Ressources/Map/0/3.png");
        m_Renderer.material.mainTexture = m_MainTexture;
        
    }

    private Texture2D LoadPNG(string filePath) {
 
        Texture2D tex = null;
        byte[] fileData;
    
        if (File.Exists(filePath))     {
            UnityEngine.Debug.Log(filePath);
            fileData = File.ReadAllBytes(filePath);
            tex = new Texture2D(2, 2);
            tex.LoadImage(fileData); //..this will auto-resize the texture dimensions.
        }

        return tex;

    }

}

But even if I apply it on an empty object, I only see my dynamic texture in the inspector, not in the scene when I press run...

over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda