- Home /
running well in unity but error while building for android
hello and hi, i have made a simple shooter game in unity its running well in unity player also i can make a built for desktop version without error but while building for android i am getting following error and such 20 errors......
Assets/Cartoon Soldier/Scripts/guns/dustCloudGenerator.js(24,56): BCE0019: 'velocity' is not a member of 'UnityEngine.Component'.
Assets/Cartoon Soldier/Scripts/guns/bulletTrace.js(65,89): BCE0019: 'Length' is not a member of 'Object'.
Assets/Cartoon Soldier/Scripts/guns/bulletTraceGenerator.js(17,99): BCE0019: 'velocity' is not a member of 'UnityEngine.Component'. . . Assets/Cartoon Soldier/Scripts/guns/bulletTraceGenerator.js(20,78): BCE0019: 'bulletSpeed' is not a member of 'UnityEngine.Component'.
. like
You might want to share the code that gives these errors. Looking here http://docs.unity3d.com/Documentation/ScriptReference/Component.html for example, Component does not have a velocity
member, so the compiler is probably right.
Answer by Loius · Feb 22, 2013 at 08:38 PM
You're using lazytyping, which is not supported on mobile devices. You have to be sure that your variables are the right type before you use them on mobile.
For instance:
var myClass : MyClassName = go.GetComponent.<MyClassName>();
myClass.myVariable = value;
But not:
var myVar = go.GetComponent(MyClassName);
myVar.anything // this will throw an error on mobile devices
If you add "#pragma strict" on its own line at the top of each script, you'll get compiler errors for most things that won't run on a mobile device. :)
ah so GetComponent will work with mobile, I did test once back on js, and yeah the type. cool
Your answer
Follow this Question
Related Questions
DLL plugins unsupported for Android Application Building 0 Answers
Unity will not accept JDK 1 Answer
How to set Unity for android development? 2 Answers
I have a build problem android. 0 Answers