Hi, I created a new project and just by adding an script with these lines
function Start () {
var mesh : Mesh = GetComponent(MeshFilter).mesh;
}
and i get the following error:
Assets/Mesh.js(2,48): BCE0022: Cannot convert ‘UnityEngine.Mesh’ to ‘Mesh’.
Any idea??
Or use
– Bunny83UnityEngine.Meshas type instead ofMeshbut that's not the recommended solution ;) You can even bypass this error by let the compiler choose the type for you, thanks to <a href="http://en.wikipedia.org/wiki/Type_inference">type-inference</a>. (Type-inference has nothing to do with dynamic typing!): var mesh = GetComponent.<MeshFilter>().mesh; When you create a variable and assign something to it during the creation the compiler statically types your variable with the assigned type.