- Home /
Building on android.
Hi I'm an avid unity developer its been a love of mine for quite a while (going on 3 years) and i've had several mess about practice projects in that time frame but i'm working on a serious game at the moment and have fairly big plans for it as so far i've put alot of work into it.
A small few details to help you understand my issue. It's a first person horror genre game. horror survival if you will, in which you play as a policeman (detective) who gets caught up to answer a late night distress call about a disturbance among some of the patients. Only to find the staff and patients missing...... but your certainly not alone.....
Now...to the point... I have been using mainly unityscript and little bits of c# lately alot of the time depending on if i cannot brew up a script to achieve my needs at the time.
I switched platform recently, to android.... in which to achieve an easier method of distribution. Via APK file being shared amongst friends/testers twitter followers etc with android supported handsets. However after determining which assets need to be reimported into my project for that plaform and the actually manage to finish importing them (My project is quite large so far).... My console log is rampant with compiler errors now after the import finishes.
I have searched high and low for a solution and the only one i can come across is talking about my variable types not being specific for android to understand. in other words.. something about... is it... "dynamic typing"
Any light shed on this topic would be greatly appreciated.
Thanks in advance folks.
Answer by pako · Feb 15, 2015 at 10:31 AM
From the manual: "For performance reasons, dynamic typing in JavaScript is always turned off in Unity Android, as if #pragma strict were applied automatically to all scripts". See "How Unity Android Differs from Desktop Unity" in:
http://docs.unity3d.com/Manual/android-GettingStarted.html
So, make sure all your variables are explicitly typed.
So var musicObject : GameObject - becomes public/private var musicObject : GameObject
Is this correct?
No, the public/private is the accessor, not the object type. Explicit typing is when you use the ": GameObject" after the variable name (or any other type ins$$anonymous$$d of GameObject).
Just make sure that all your variables declare a type by using
": TYPE" after the variable name.
See also this:
http://answers.unity3d.com/questions/206424/pragma-strict.html
I got this problem sorted. $$anonymous$$uch appreciated. Now stuck with many draw calls and the draw call package from asset store gives errors lol
Please note that it's considered good practice in this forum to accept an answer that has helped you (click the check-mark icon below the down-vote icon). It's also good practice to up-vote the answers and comments that you have found are especially useful.
Your draw calls issue seems to be the subject for a new question, as this one has been answered.
Your answer
Follow this Question
Related Questions
'GetComponent' is not a member of 'Object'. 2 Answers
How do i need to change this script for mobile? 1 Answer
game won't work in build 0 Answers
[JS] Match 3 game - How to compare certain values stocked in a multi-dimensional Array 1 Answer
how to make it that longer the key is pressed the faster the object rotates? 1 Answer