components attached I mean by name of each component.
var list = gameObj.GetComponents(typeof(Component));
if (!componentsList.Contains(gameObj.name))
componentsList.Add(gameObj.name);
for (int i = 0; i < list.Length; i++)
{
if (!componentsList.Contains(list[i].name))
componentsList.Add(list[i].name);
}
This code create a List only with GameObjects. But I want a List in this format for example:
Cube1 Mesh Renderer Box Collider Sphere Mesh Renderer Box Collider
In the end a List with each object name and the components of it.