- Home /
How can I add a button to a list?
I added a button and appears in the inspector but not on the scene, so i cant use it. Here the code.
using System; using UnityEngine; using System.Collections; using System.Collections.Generic;
public class PieMenu : MonoBehaviour {
public List<Texture> icons ;
public List<string> commands;
public List<UnityEngine.UI.Button> buttons;
public float iconSize = 64f;
public float spacing = 12f;
public float speed = 8f;
public GUISkin skin;
[HideInInspector]
public float scale;
[HideInInspector]
public float angle;
PieMenuManager manager;
void Awake () {
manager = PieMenuManager.Instance;
}
void OnMouseOver() {
manager.Show(this);
}
}
Comment
Answer by meat5000 · Oct 04, 2015 at 09:38 PM
It seems you have declared your list but not initialised it, or added anything to it.
Your answer
![](https://koobas.hobune.stream/wayback/20220612040039im_/https://answers.unity.com/themes/thub/images/avi.jpg)