Menu not displayed on mobile device

Hello Community,

i have a little problem. I have a menu that i create dynamicly through a code.
when i take a look at the menue in the preview mode in unity the menue is displayed.
But when i test it on the mobile phone, android, the menu is not displayed.

this is what it should look like. but on the mobile phone there are no buttons.

below is the code.

myPanel is is the canvas on which the content(buttons) are on.
mybutton prefab1 and 2 are the buttons for the leves that are ready to play and those which are closed.

using UnityEngine;
using System.Collections;
using System.Collections.Generic; using UnityEngine.UI;
public class DisplayText : MonoBehaviour {

	public RectTransform myPanel;
	public GameObject myButtonPrefab1; 
	public GameObject myButtonPrefab2;

	public static int levelNumber = 45;
	public static int levelnummer;

	List<string> chatEvents;
	private GameObject newButton;

	// Use this for initialization
	void Start () {

		Vector2 tempCanvas = this.GetComponent<RectTransform> ().sizeDelta;
		tempCanvas = new Vector2 (Screen.width, Screen.height);
		this.GetComponent<RectTransform>().sizeDelta = tempCanvas;

		Vector3 temp = myPanel.GetComponent<GridLayoutGroup> ().cellSize;
		temp.x = Screen.height / 5;
		temp.y = Screen.width / 5;
		myPanel.GetComponent<GridLayoutGroup> ().cellSize = temp;

		Vector3 temp2 = myPanel.GetComponent<GridLayoutGroup> ().spacing;
		temp2.x = 0F;
		temp2.y = 0F;
		myPanel.GetComponent<GridLayoutGroup> ().spacing = temp2;

		Vector3 tempPanel = myPanel.GetComponent<RectTransform> ().position;
		tempPanel.y = ((Screen.width / 5) * (75 / 5)) * (-1);

		myPanel.GetComponent<RectTransform> ().position = tempPanel;



		chatEvents = new List<string>();


		levelnummer = 0;
		for (int i = 1; i < 76; i++) {

			if (levelNumber >= levelnummer) {
				string buttonText = i.ToString();
				chatEvents.Add(buttonText);
				newButton = (GameObject)Instantiate (myButtonPrefab1);
				newButton.transform.SetParent(myPanel);
				newButton.GetComponentInChildren<Text>().text = chatEvents[levelnummer];
				Button b = newButton.GetComponent<Button>();
				Vector3 tempScale = b.GetComponent<RectTransform>().localScale;
				tempScale.x = 1;
				tempScale.y = 1;
				b.GetComponent<RectTransform>().localScale = tempScale;
				/*Vector3 tempZpos = b.GetComponent<RectTransform>().sizeDelta;
				tempZpos = new Vector3 (0,0, 1);
				b.GetComponent<RectTransform>().sizeDelta = tempZpos;*/
				
				AddListener(b, buttonText);
				levelnummer++;
			}
			else if(levelnummer < 76){
				string buttonText = "";
				chatEvents.Add(buttonText);
				newButton = (GameObject)Instantiate (myButtonPrefab2);
				newButton.transform.SetParent(myPanel);
				newButton.GetComponentInChildren<Text>().text = buttonText;
				Vector3 tempScale = newButton.GetComponent<RectTransform>().localScale;
				tempScale.x = 1;
				tempScale.y = 1;
				newButton.GetComponent<RectTransform>().localScale = tempScale;
				/*Vector3 tempZpos = newButton.GetComponent<RectTransform>().sizeDelta;
				tempZpos = new Vector3 (0,0, 1);
				newButton.GetComponent<RectTransform>().sizeDelta = tempZpos;*/
				levelnummer++;
			}
		}
	}

	void AddListener(Button b, string buttonText){

				b.onClick.AddListener (() => NextLevelButton(buttonText));

	}

	public void NextLevelButton(string level)
	{
		int lvl = int.Parse (level);

		Application.LoadLevel(lvl);
	}

}

thanks for any help on this problem

Lukas

SOLVED!!!

The problem was, that the background canvas was not set to screenwidth and height. I edited this in my code.
The next problem was that the canvas render mode was set to screen space camera and i changed it to screen space overlay.

thanks…