Can i change the text of a Serialized List object?

see topic

i do dis:

[System.Serializable]
public class BuildingInstance
{
    [SerializeField] private List<GameObject> WorkStationList = new List<GameObject>();
    [SerializeField] private GameObject FloorLevel;

result dis:

id like to change the text of “Element” (number)

can i do this? if yes how pls ?

I think in those ancient versions of Unity, having a serialized member in the class called ‘name’ would update the Element 0 text to match.

1 Like

can you give me a example, couse i am not sure i can follow you?

assigning a GameObject does not change anything, same result for creating a new GameObject and adding that object

Pretty much just this:

[System.Serializable]
public class BuildingInstance
{
    [SerializeField]
    private string name; // <- this
    
    [SerializeField] private List<GameObject> WorkStationList = new List<GameObject>();
    [SerializeField] private GameObject FloorLevel;
}

Obviously this doesn’t work with a list of Unity objects.

2 Likes

yeah not really what i am looking for but creative thought

My point is that the text in the field will also be reflected in lieu of Element 0 and so on.

1 Like

In fact the member doesn’t need to have the name name. Unity will simply use the first serialized string field in the class / struct as the element name.

2 Likes