patpfp
January 10, 2025, 12:28am
1
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
patpfp
January 10, 2025, 1:10am
3
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
patpfp
January 10, 2025, 1:26am
5
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