[Photos added]Changing size of list in hierarchy not working.

19725-asdf.png

Above picture: I want to add an element by changing the size to 1 but it doesn’t change to one it stays as 0… T.T

PS: I’ve already put up a lot of questions on this in the past… Nobody knows what the answer…

I have a list like: public List somelist = new List(); and whenever I try to increase the element size (the number of things in the list), it always changes back to zero. Is there anyway to change element size in the script? Help?

I’m not finished but, alright, here’s the whole script:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class map: MonoBehaviour 
{
	public static map instance;
	public List<mapsettings> maplist = new List<mapsettings>();
	private mapsettings loadmap = null;

	void Awake()
	{
		instance = this;
		loadmap = maplist[0];
	}

	// Use this for initialization
	void Start () 
	{
	
	}
	
	// Update is called once per frame
	void Update () 
	{
	
	}

	void OnGUI ()
	{
		if(guiscript.startserver == true)
		{
			GUILayout.BeginArea(new Rect(0,0,500,550))

			foreach(mapsettings map in maplist)
				GUILayout.Button(map.mapname);

			GUILayout.EndArea();
		}
	}
}


[System.Serializable]
public class mapsettings
{
	public string mapname;
	public string maploadname;
}

Found similar post: Can't add animation element? - Unity Answers

Hello,

The type List<> is not seizable and is not accessible from the inspector. Therefore it is neither saved nor loaded with a prefab or a scene and will not persist. If you want a collection that is seizable and shows up in the inspector, I suggest you use built-in arrays instead, however they do come with the downside that they are fixed size.

The fact that the List<> mapList shows in the hierarchy is either due to a custom editor or a very obscure bug. In either case it’s incorrect and shouldn’t be there.

Hope this helps,
Benproductions1