Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

250
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda