ソースコード
using System.Linq; using UnityEngine; public class Example : MonoBehaviour { private void Awake() { var meshes = GetComponentsInChildren<MeshFilter>( true ) .Select( c => c.sharedMesh ) ; var skinnedMeshes = GetComponentsInChildren<SkinnedMeshRenderer>( true ) .Select( c => c.sharedMesh ) ; var count = meshes .Concat( skinnedMeshes ) .Sum( c => c.triangles.Length / 3 ) ; Debug.Log( count ); } }