Quantcast
Channel: Questions in topic: "build"
Viewing all articles
Browse latest Browse all 4084

Texture not visible on manual mesh after build

$
0
0
I build a quad from code and assign a texture to it, it works when i start the game from the editor. When i build the game and launch the .exe the quad is white without textures. This is the code
     public GameObject create_ground_object(float w,float h)
            { 
            Mesh mesh = create_ground_quad(w,h);
            GameObject ground = new GameObject("ground",typeof(MeshRenderer),typeof(MeshFilter));
            ground.GetComponent(). sharedMesh = mesh;  
            Texture texture = (Texture) Resources.Load(terrain_type);
            ground.GetComponent().material.mainTexture = texture;
            var shader = Shader.Find ("Unlit/Transparent");
            ground.GetComponent().material.shader = shader;
            return ground;
            }  
If i add at the end of the function Debug.Log ("texture name "+texture.name); Debug.Log ("texture height "+texture.height); Debug.Log ("shader name "+shader.name); they are all correct. The textures are in the resource folder and i added the shader to the include list. Why my quad is white?

Viewing all articles
Browse latest Browse all 4084

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>