I put all my Scene objects in an array to build a menu from, like this:
public class LevelMenus : MonoBehaviour
{
public Object[] levels; //my scene objects go here, from inspector.
private Vector2 scrollPosition;
public void OnGUI()
{
GUILayout.BeginArea(new Rect(20, 20, Screen.width - 20, Screen.height - 20));
scrollPosition = GUILayout.BeginScrollView(scrollPosition);
GUILayout.BeginVertical();
for (int i = 0; i < levels.Length; i++)
{
if(GUILayout.Button(levels*.name, GUIManager.ButtonTextStyle))*
*{*
_Application.LoadLevel(levels*.name);*_
_*}*_
_*}*_
_*GUILayout.EndVertical();*_
_*GUILayout.EndScrollView();*_
_*GUILayout.EndArea();*_
_*}*_
_*}*_
_*```*_
_*<p>This works fine in the editor, but if I make an executable (either for PC or Android), entries in the array are all null (although the array is the right size).</p>*_
_*<p>Am I doing something wrong, or is this a Unity bug?</p>*_