- Home /
BCE0019: 'mesh' is not a member of 'UnityEngine.Component' on Android Build
When trying to Build a game for android, I get this error "BCE0019: 'mesh' is not a member of 'UnityEngine.Component'" 3 times.
In here
if(GetComponent(MeshFilter).mesh == null)
GetComponent(MeshFilter).mesh = new Mesh();
& in here
var mesh : Mesh = GetComponent(MeshFilter).mesh;
Anybody any idea on how to fix this?
Thanks in advance!!
Answer by Eric5h5 · Apr 08, 2011 at 01:34 AM
GetComponent returns Component, and indeed mesh is not a member of Component. If you're not using dynamic typing then you have to cast it correctly. If you want less typing, use generics.
GetComponent.<MeshFilter>().mesh = ...
Answer by ThomasQ · Apr 08, 2011 at 01:20 AM
Again. I'm gonna awnser my own question... I've got to stop asking to quickly :D
here's the working code:
if((GetComponent(MeshFilter) as MeshFilter).mesh == null)
(GetComponent(MeshFilter) as MeshFilter).mesh = new Mesh();
&
var mesh : Mesh = (GetComponent(MeshFilter) as MeshFilter).mesh
I still don't know how this works, so if someone could clarify on this, would be great..
Your answer
Follow this Question
Related Questions
Facebook Platform Policies and Promotions Policies 0 Answers
Empty game objects - too much? 3 Answers
Making an Input Listener Via Touch 1 Answer
Movie texture on mobiles! 3 Answers
motionblur not work on my android phone(android/ios) 1 Answer