- Home /
Switching Platform to Android creates script errors
I have been running my game, (destined for Android) on my PC up until now. But I finally decided to go Build Settings>click on Android>Switch Platform. After reimporting tons of assets, it racks up 358 script errors, plus some warnings.
They are almost all either
BCE0005 'randomVar' is not a member of 'UnityEngine.Collider' or
BCE0019 Unknown identifier: 'finalTorque'
I can't go through all 358 of course, but is there something I'm doing wrong? I think all of my scripts are affected by this, so I'm pretty sure there's just something I'm not doing right.
Dynamic Typing? Something missing at the top of my scripts? Do I need #pragma strict or something?
Please help! I'm stuck right now.
Dave
From my experience, most likely you are using generic var only? use the exact type for each variable ins$$anonymous$$d...
I will do that. Thanks! BTW, do I need #pragma strict at the top? Also, do I need any namespaces or anything? Right now, my Javascripts have nothing at the top.
its optional to have the pragma strict on top but its better to optimize your code
Warnings come up on the top of my scripts that say that Namespaces "System.Collections" and "UnityEditor" are never used. Is that a problem?
it shouldnt be a problem.. this might explains:
Answer by SolidSnake · Nov 13, 2012 at 06:07 PM
motorTorque in member of WheelCollider not Collider
Answer by roymeredith · May 24, 2017 at 07:38 AM
I have same pRoblem it's ok in pc build, but when switched to Android it's shows an errors. Did you sort it out..it's doing my head in!!! ,I have same pRoblem it's find in pc build, when I switch to android it's shows errors..did you work it out?
Answer by LSongulija · Sep 21, 2020 at 10:01 PM
Yes i had same problem. I bought game from asset store. Couldn't understand what was the reason that it throws like 30 errors when Switching to Android platform. In my case almost all errors were CS0246. So i find solution in https://support.unity3d.com/hc/en-us/articles/212065246-Why-does-integrating-Unity-IAP-result-in-compiler-errors-. In-App-Purchasing was turned of. When i turned in on almost all errors solved.