I want to generate grid on canvas, but i don’t want fill canvas so i spawn objects inside Panel, but even without Panel and adding Images to Canvas images are still invisible
I have Canvas which have Panel as children which contains my script to spawn and GridLayoutGroup, I want to Instantiate prefab which contains UI Image but when making it by script my Images are invisible
I have this script attached to my Panel
for(int x =0;x<width;x++){
for(int y=0;y<height;y++){
GameObject newTile = Instantiate(_tilePreset,gameObject.transform.position,Quaternion.identity);
gridMapGameObjects[x,y]=newTile;
newTile.transform.SetParent(gameObject.transform);
}
}
It only works when adding manually every image to my Panel.
It worked with SpriteRenderer but sprites are over UI elements