Why it is happening? Files should not be missing, I build texture within program.
Imgur: The magic of the Internet (works in editor)
Imgur: The magic of the Internet (fails in a produced executable)
I am on Ubuntu 19.10 (not sure what else can be relevant).
Script is attached to an empty gameobject. If useful I may publish git repo with the entire project.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MapMaker : MonoBehaviour
{
void Start()
{
int size = 100;
//code from https://stackoverflow.com/questions/27929643/procedural-textures-in-unity
Texture2D texture = new Texture2D(size, size, TextureFormat.ARGB32, false);
texture.filterMode = FilterMode.Point;
for (int x = 0; x < size; x++) {
for (int y = 0; y < size; y++) {
Color color = Color.blue;
if(x<10) {
color = Color.red;
}
if(y<10) {
color = Color.green;
}
texture.SetPixel(x, y, color);
}
}
texture.Apply();
//end of copied code
GameObject screen = GameObject.CreatePrimitive(PrimitiveType.Quad);
screen.transform.name = "screen";
screen.transform.position = new Vector3(0, 0, 1);
screen.transform.localScale = new Vector3(10, 10, 1);
screen.GetComponent<Renderer>().material.mainTexture = texture;
}
}