using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
public class CountMesh : MonoBehaviour {
[MenuItem("Tools/MESHS")]
static void LogMeshF()
{
List<MeshFilter> mesh = new List<MeshFilter>();
GameObject[] gameObjects = Selection.gameObjects;
for (int i = 0; i < gameObjects.Length; i++)
{
MeshFilter[] meshFilters= gameObjects[i].GetComponentsInChildren<MeshFilter>();
for (int j = 0; j < meshFilters.Length; j++)
{
if (!mesh.Contains( meshFilters[j]))
{
mesh.Add(meshFilters[j]);
}
}
}
int virtices=0;
int tris=0;
for (int i = 0; i < mesh.Count; i++)
{
virtices += mesh[i].sharedMesh.vertexCount;
tris += mesh[i].sharedMesh.triangles.Length/3;
}
Debug.Log("virtices:"+ virtices + " tris:"+tris);
}
}
More than 1 year has passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme
List of users who liked
00