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