Legacy Documentation: Version 4.5.0

Script language:

  • JS
  • C#
  • Boo
Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

Mesh.vertexCount

var vertexCount: int;
int vertexCount;
vertexCount as int

Description

Returns the number of vertices in the mesh (Read Only).

	function Start () {
		var mesh : Mesh = GetComponent(MeshFilter).sharedMesh;
		print(mesh.vertexCount);
	}
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    void Start() {
        Mesh mesh = GetComponent<MeshFilter>().sharedMesh;
        print(mesh.vertexCount);
    }
}
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	def Start() as void:
		mesh as Mesh = GetComponent[of MeshFilter]().sharedMesh
		print(mesh.vertexCount)