using UnityEngine; public class Example : MonoBehaviour { [SerializeField] private bool GenerateInstances = true; private void Awake() { if (!GenerateInstances) { return; } int num = 0; string text = string.Empty; MeshFilter[] array = Object.FindObjectsOfType(); for (int i = 0; i < array.Length; i++) { if (i % 2 == 0) { Mesh mesh = array[i].mesh; text = text + mesh.ToString() + " "; num++; } } Debug.Log("Instantiated " + num + " meshes. " + text); num = 0; text = string.Empty; MeshRenderer[] array2 = Object.FindObjectsOfType(); for (int j = 0; j < array2.Length; j++) { if (j % 2 == 0) { Material material = array2[j].material; text = text + material.ToString() + " "; num++; } } SkinnedMeshRenderer[] array3 = Object.FindObjectsOfType(); for (int k = 0; k < array3.Length; k++) { if (k % 2 == 0) { Material material2 = array3[k].material; text = text + material2.ToString() + " "; num++; } } Debug.Log("Instantiated " + num + " materials. " + text); } }